ump*_*sky 3 themes assets symfony
我想在我的Symfony2项目中获得基本的主题支持,所以我想为每个主题分离静态文件(css,js,img).
我试过补充一下
assetic:
read_from: %kernel.root_dir%/../web/themes/mytheme
Run Code Online (Sandbox Code Playgroud)
但是这没有任何效果,我的{{asset('css/style.css')}}仍在引用%kernel.root_dir%/ ../web,而不是%kernel.root_dir%/ ../web/themes/mytheme的.
任何的想法?
修复配置:
assetic:
debug: %kernel.debug%
use_controller: false
read_from: %kernel.root_dir%/../web/bundles/mybundle/themes/%my_theme%
write_to: %kernel.root_dir%/../web
filters:
yui_css:
jar: "%kernel.root_dir%/Resources/java/yuicompressor.jar"
yui_js:
jar: "%kernel.root_dir%/Resources/java/yuicompressor.jar"
Run Code Online (Sandbox Code Playgroud)
在布局中我有:
{% stylesheets 'css/*' filter='?yui_css' %}
<link rel="stylesheet" type="text/css" media="all" href="{{ asset_url }}" />
{% endstylesheets %}
Run Code Online (Sandbox Code Playgroud)