1

I have a super class twig which has the following block:

{% stylesheets filter='css_url_rewrite,?yui_css'
                '@MainBundle/Resources/public/css/bootstrap.css'
                '@MainBundle/Resources/public/css/vendor/*.css'
                '@MainBundle/Resources/public/css/_normalize.css'
                '@MainBundle/Resources/public/css/main.css'
                '@MainBundle/Resources/public/css/fonts.css'
                '@MainBundle/Resources/public/css/include/*.css'
                '@MainBundle/Resources/public/css/footer.css'
            %}

I have another twig that extends from the twig above, but I wanted to add an additional css on this page, so I did:

{% block stylesheets %}
     {{ parent() }}
    {% stylesheets filter='css_url_rewrite,?yui_css'
        '@ShopiousMainBundle/Resources/public/css/shippingconfirm/*.css'
    %}
    {% endstylesheets %}          
{% endblock %}

however this doesn't import the css that I have inside shippingconfirm, Any idea on how to fix this?

adit
  • 32,574
  • 72
  • 229
  • 373

1 Answers1

2

You need to set the link element again in your stylesheets block. So it should work with the following:

{% block stylesheets %}
    {{ parent() }}
    {% stylesheets filter='css_url_rewrite,?yui_css'
        '@ShopiousMainBundle/Resources/public/css/shippingconfirm/*.css' %}
        <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

But your additional stylesheets in the shippingconfirm folder will be in an extra file. Assetic won't put all stylesheets (css from parent and css from the current template) into one file.

A similar question was posted here: Combining Assetic Resources across inherited templates

There you can find some approaches to fix your problem.

Community
  • 1
  • 1
stedekay
  • 477
  • 1
  • 4
  • 9
  • I edited my question above based on the answer you provided, however the issue now is different, such that it's not importing the css that I have in the child – adit Apr 09 '13 at 16:40