Symfony/Twig: Extending stylesheet block from an extended bundle
<p>I'd like to extend the <code>stylesheets</code> blocks from inside a bundle I've created to extend <code>FOSUserBundle</code>.</p>

<p><a href="https://stackoverflow.com/questions/11114033/extending-stylesheet-block">This is how to extend from inside the same bundle</a>, but I want to extend from another bundle that extends a third-party bundle.</p>

<p>This is the code:</p>

<pre><code>{# src/MyNamespace/UserBundle/views/layout.html.twig #}
{% extends '::base.html.twig' %}

{% block stylesheets %}
    {{ parent() }}
    {% stylesheets filter='scssphp,cssrewrite' output='css/app.css'
    'bundles/mynamespace/scss/Profile.scss'
    %}
    {% endstylesheets %}
{% endblock %}

{% block title %}My title{% endblock %}

{% block body %}
    {% block fos_user_content %}{% endblock %}
{% endblock %}
</code></pre>

<p>So, basically, I've extended the <code>FOSUserBundle</code> creating another bundle in my <code>src</code> directory <a href="http://symfony.com/doc/current/cookbook/bundles/inheritance.html#overriding-resources-templates-routing-etc" rel="nofollow noreferrer">as explained here</a>.</p>

<p>The code of my `base.html.twig template is this:</p>

<pre><code>{# app/Resources/views/base.html.twig #}
...
    &lt;head&gt;
        ...
        &lt;title&gt;{% block title %}{% endblock %}&lt;/title&gt;
        &lt;meta name="description" content="{% block metaDescription %}{% endblock %}" /&gt;
        {% include('::_common/Stylesheets.html.twig') %}
...
</code></pre>

<p>And this is the included <code>Stylesheets.html.twig</code>:</p>

<pre><code>{% block stylesheets %}
    {% stylesheets filter='scssphp,cssrewrite' output='css/app.css'
    'bundles/app/css/bootstrap.css'
    ...
    %}
    &lt;link rel="stylesheet" href="{{ asset_url }}" /&gt;
    {% endstylesheets %}
{% endblock %}
</code></pre>

<p>The problem is that the CSS from <code>src/MyNamespace/UserBundle/views/layout.html.twig</code> is never included in the page, also if it is installed with <code>app/console asstes:install</code> and then dumped with <code>app/console assetic:dump</code>.</p>

<p>The CSS is generated and put in <code>web/css/app_Profile_1.css</code> but is never included in the pages (not in home page or other <code>AppBundle</code> pages, not in <code>MyNamespaceUserBundle</code> pages.</p>

<p>Also adding the line <code>&lt;link rel="stylesheet" href="{{ asset_url }}" /&gt;</code> to the <code>src/MyNamespace/UserBundle/views/layout.html.twig</code> block, the CSS isn't included.</p>

<p>Obviously, if I include the stylesheet directly from <code>_common/Stylesheets.html.twig</code> the file is correctly included.
So, it seems there is something break.</p>

<p>Anyone can help me?</p>