Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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('css/style.css') }} are still referencing realtic to %kernel.root_dir%/../web, instead %kernel.root_dir%/../web/themes/mytheme.

Any idea?

like image 864
umpirsky Avatar asked Jan 28 '26 16:01

umpirsky


1 Answers

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 %}
like image 84
umpirsky Avatar answered Jan 30 '26 07:01

umpirsky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!