开发者

Symfony2 theming

I want basic theming support in my Symfony2 project, so I wanted to have separated static files (css, js, img) for each theme.

I have tried to add

assetic:
    read_from:  %kernel.root_dir%/../web/themes/mytheme

but this took no effect, my {{ asset(开发者_StackOverflow中文版'css/style.css') }} are still referencing realtic to %kernel.root_dir%/../web, instead %kernel.root_dir%/../web/themes/mytheme.

Any idea?


Fixed with config:

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"

And in layout I have:

    {% stylesheets 'css/*' filter='?yui_css' %}
    <link rel="stylesheet" type="text/css" media="all" href="{{ asset_url }}" />
    {% endstylesheets %}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜