Reputation: 1457
Is there anyone that can explain me how stylesheets work in Symfony?
According to the documentation, I should use the following code:
{% block stylesheets %}
{% stylesheets 'bundles/app/css/*' filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
So this is how my base.html.twig <head>
tag would look like:
3 <head>
4 <meta charset="UTF-8" />
5 <title>{% block title %}Welcome!{% endblock %}</title>
6 {% block stylesheets %}
7 {% stylesheets 'bundles/app/css' filter='cssrewrite' %}
8 <link rel="stylesheet" type="text/css" href="" />
9 {% endstylesheets %}
10 {% endblock %}
11 <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
12 </head>
But when I go to any page, I see the following error:
Unexpected "stylesheets" tag (expecting closing tag for the "block" tag defined near line 7) in base.html.twig at line 7.
Thanks in advance.
Upvotes: 0
Views: 473
Reputation: 3822
First you need manually install and configure assetic - as it's no longer added by default to Symfony (https://github.com/symfony/symfony-standard/pull/860).
You have all the informations in liked by you cookbook.
Upvotes: 1