Reputation: 4561
I wanted to add stylesheet with a variable inside
{% stylesheets combine=true
'@MyBundle/Resources/public/css/*'
'@MyBundle/Resources/public/XXX/css/*'
'@CramifCramifKitBundle/Resources/public/jquery/css/' ~ jquery_theme ~ '/jquery-ui-1.1.10.custom.min.css'
filter='cssembed'
%}
<link rel="stylesheet" href="{{ asset_url }}" type="text/css" />
{% endstylesheets %}
but it is not possible to put variables in the {% stylesheets %} block.
so I decided to do that way :
{% stylesheets combine=true
'@CramifCramifKitBundle/Resources/public/css/*'
'@CramifCramifKitBundle/Resources/public/JQMenu/css/*'
filter='cssembed'
%}
<link rel="stylesheet" href="{{ asset_url }}" type="text/css" />
{% endstylesheets %}
<link type="text/css" rel="stylesheet" href="{{ asset('bundles/mybundle/jquery/css/' ~ jquery_theme ~ '/jquery-ui-1.1.10.custom.min.css') }}" />
of course I ran the command line : assets:install
The resources are in the web/bundles/mybundle folder, no problem
The problem is that the server returns a 404 error (the path is right thugh). More than that, when I type in the browser the url even to the bundles folder under web, same error 404
Maybe you can tell me another way to load css with dynamic paths
Upvotes: 1
Views: 1572
Reputation: 194
It's a known problem in Assetic :
try to replace @BundleName/Resources/public/
by bundles/names/{css, js, images or whatever}/*
in your {% stylesheets %}
block
More informations here : https://github.com/kriswallsmith/assetic/issues/53#issuecomment-2523420
Upvotes: 0