title: Symfony2: How to properly include assets in conjunction with Twig template inheritance?
body: <p>I'm currently developing a web application using Symfony 2.1.0.</p>
  
  <p>I've read through the <a href="http://symfony.com/doc/current/book/templating.html">Templating chapter</a> of the book and I'm trying to include assets (right now, it's just a single stylesheet) in my web pages.</p>
  
  <p>I'm using the <a href="http://symfony.com/doc/current/book/templating.html#three-level-inheritance">Three-level inheritance system</a> that is mentioned in the book, and my application structure currently looks like this:</p>
  
  <ul>
  <li><strong>app/Resources/views/</strong>
  <ul>
  <li><em>base.html.twig:</em> base template, containing <em>title</em>, <em>stylesheets</em> and <em>body</em> blocks.</li>
  </ul></li>
  <li><strong>src/My/PageBundle/Resources/views</strong>
  <ul>
  <li><em>layout.html.twig:</em> layout template (extending the base template), appending the main stylesheet to the <em>stylesheet</em> block, and overwriting the <em>body</em> block, including <em>navigation.html.twig</em> and defining a <em>content</em> block</li>
  <li><em>layout-admin.html.twig:</em> same thing as above, but including <em>navigation-admin.html.twig</em></li>
  <li><strong>src/My/PageBundle/Resources/views/Main</strong>
  <ul>
  <li>standard templates, extending the layout template and overwriting its <em>content</em> block</li>
  </ul></li>
  <li><strong>src/My/PageBundle/Resources/views/Administration</strong>
  <ul>
  <li>administration templates. Same thing as above, but extending the administration layout template.</li>
  </ul></li>
  </ul></li>
  <li><strong>src/My/PageBundle/Resources/public/css</strong>
  <ul>
  <li><em>main.css:</em> main stylesheet</li>
  </ul></li>
  </ul>
  
  <p>As you can see, I have put the stylesheet in my bundle. I don't know whether this is good practice or not.</p>
  
  <p>Now, the thing is, in layout.html I added this:</p>
  
  <pre><code>{% block stylesheets %}
      {{ parent() }}
  
      &lt;link rel="stylesheet" type="text/css" href="{{ asset('css/main.css)' }}" /&gt;
  {% endblock %}
  </code></pre>
  
  <p>But <code>asset('css/main.css')</code> is just linking to <code>/css/main.css</code>, whereas <code>./app/console assets:install</code> installs the assets in <code>web/bundles/mypagebundle/</code>. I don't like the fact that this way, my bundle name would be publicly visible (which could make users suspect I'm using Symfony, and I like keeping the internals of my webpage, well, internal). Is it possible to change the directory where <code>assets:install</code> would install the assets? It seems tedious to me to manually install the assets in web/.</p>
  
  <p>I'm also thinking about using Assetic for asset management, as I personally like the possibility to automatically minify my scripts/stylesheets and store them all together in one file. However, I hear that this is not possible if you include stylesheets at different levels, i.e. it wouldn't work with the three-level inheritance system. Is it possible to work around that? Also, would using Assetic enable me to hide my bundle name from the public?</p>