title: Assetic and Silex - debug mode
body: <p>First Stackoverflow question. UHUH!</p>
  
  <p>Silex-Assetic as doing my head in. </p>
  
  <p>Following the docs on <a href="https://github.com/mheap/Silex-Assetic/blob/master/doc/assetic.rst" rel="nofollow">https://github.com/mheap/Silex-Assetic/blob/master/doc/assetic.rst</a> and the demo on <a href="https://github.com/mheap/Silex-Assetic-Demo" rel="nofollow">https://github.com/mheap/Silex-Assetic-Demo</a> I ended up with this:</p>
  
  <pre><code>$app-&gt;register(new SilexAssetic\AsseticServiceProvider());
  
  $app['assetic.path_to_web'] = __DIR__ . '/assets/min';
  $app['assetic.options'] = array(
      'debug'              =&gt; true,
      'auto_dump_assets'  =&gt; true
  );
  
  $app['assetic.filter_manager'] = $app-&gt;share(
  $app-&gt;extend('assetic.filter_manager', function($fm, $app) {
          $fm-&gt;set('yui_css', new Assetic\Filter\Yui\CssCompressorFilter(
              __DIR__ . '/../yuicompressor-2.4.7.jar'
          ));
          $fm-&gt;set('yui_js', new Assetic\Filter\Yui\JsCompressorFilter(
              __DIR__ . '/../yuicompressor-2.4.7.jar'
          ));
  
          return $fm;
      })
  );
  
  $app['assetic.asset_manager'] = $app-&gt;share(
      $app-&gt;extend('assetic.asset_manager', function($am, $app) {
          $am-&gt;set('dragons', new Assetic\Asset\AssetCache(
              new Assetic\Asset\GlobAsset(
                  __DIR__ . '/assets/css/*.css',
                  array($app['assetic.filter_manager']-&gt;get('yui_css'))
              ),
              new Assetic\Cache\FilesystemCache(__DIR__ . '/../cache/assetic')
          ));
          $am-&gt;get('dragons')-&gt;setTargetPath('dragons-min.css');
  
          return $am;
      })
  );    
  </code></pre>
  
  <p>And, on my twig file:</p>
  
  <pre><code>{% stylesheets '../../assets/css/*.css' filter='yui_css' output='/assets/min/dragons-min.css' %}
      &lt;link href="{{ asset_url }}" type="text/css" rel="stylesheet" /&gt;
  {% endstylesheets %}
  </code></pre>
  
  <p>I'm having two problems:</p>
  
  <ul>
  <li>Somehow I end with the a dragons-min.css file in <code>/assets/min/dragons-min.css</code> AND on <code>/assets/min/assets/min/dragons-min.css</code></li>
  <li>If I enable debug mode, I end up with weird files.</li>
  </ul>
  
  <p>Like this: </p>
  
  <pre><code>&lt;link href="/assets/min/dragons-min_part_1_bootstrap.min_1.css" type="text/css" rel="stylesheet" /&gt;
  &lt;link href="/assets/min/dragons-min_part_1_main_2.css" type="text/css" rel="stylesheet" /&gt;
  &lt;link href="/assets/min/dragons-min_part_1_normalize_3.css" type="text/css" rel="stylesheet" /&gt;
  </code></pre>
  
  <p>If debug mode is off, I would like to be calling the original files on <code>/assets/css</code>. And also not to end up with a duplicated directory structure.</p>
  
  <p>The documentation is VERY bad at this stage and I'm a bit new with Silex too. I would love to have my structure and code challenged by you. :)</p>