I have stylesheet block in base layout:
{% stylesheets
filter='cssrewrite'
'bundles/static/css/main.css'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
I am wonder if I can extend this block in sub template. Add another CSS link or links.
Could somebody give me any advice? Is this even possible?
Of course, it's possible.
But currently, you don't have stylesheet block. You use the stylesheets tag.
Just add a block like this:
{% block stylesheets %}
{% stylesheets
filter='cssrewrite'
'bundles/static/css/main.css'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
And in others templates:
{% block stylesheets %}
{{ parent() }}
{% stylesheets
filter='cssrewrite'
'another-css-file'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
Don't forget to call the parent
function to not override parent stylesheets.