I'm using Symfony with Twig and I use assetic. The problem is that my CSS file includes other CSS files like that:
@import url(ie8.css);
@import url(blocks.css);
@import url(plugins.css);
@import url(app.css);
And these files are not found when webpage is displayed. Same happens with fonts and images. How do I solve this?
I have to mention that I load css files like that:
{% stylesheets
'@BaseBundle/Resources/public/plugins/bootstrap/css/bootstrap.min.css'
'@BaseBundle/Resources/public/css/style.css'
filter='cssrewrite'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
From the Symfony docs and this section as well:
and
The
cssrewrite
filter is crucial as it will rewrite thoseurl()
CSS paths that you defined in your stylesheets. By using the@AppBundle
syntax, this no longer happens. You need to load CSS files like this:Note the paths may not be 100% correct (it depends on your bundle name). You should double check by performing
php app/console assets:install
and look in yourweb/
folder.