Reputation: 343
I have tried in Symfony 3 and symphony 2.8 both to use the AsseticBundle CSS and stylesheets but I am keep getting an error ...
Unexpected "stylesheets" tag (expecting closing tag for the "block" tag defined near line 8) in ::base.html.twig at line 8. 500 Internal Server Error - Twig_Error_Syntax
This is what I am trying to address ---
{% block stylesheets %}
{% stylesheets 'bundles/admin/css/*' filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
I have search for the solution and I find that it has been removed from the new version, so if it is removed from the new version how can I address my stylesheet?
Upvotes: 3
Views: 5500
Reputation: 2422
As Joshua says follow the the instruction from Symfony https://symfony.com/doc/current/cookbook/assetic/asset_management.html#installing-and-enabling-assetic
And just give the directory where your CSS and JavaScript files are --
for instant you have a admin bundle and you want to give the directory, what you do is that you go to your config.yml
file add the following code -
{% javascripts
'@AdminBundle/Resources/public/js/*'
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
Hope it answer's your question !
Upvotes: 3
Reputation: 2982
The Assetic Bundle has been removed from the standard installation in Symfony 3. You have to install it by hand: https://symfony.com/doc/current/cookbook/assetic/asset_management.html#installing-and-enabling-assetic
Upvotes: 8