Search code examples
symfonyassetsasseticsymfony-2.8

Symfony2 - assets not loaded when use_controller is set to false


I dumped assetics and set use_controller to false in config.yml:

assetic:
    debug:          '%kernel.debug%'
    use_controller: false
    filters:
        cssrewrite: ~

But now assets are not loaded! Shouldn't use_controller be used for dynamic loading when assetics are not dumped?

I load assets in twig like this:

{% stylesheets filter='scssphp' output='css/style.css'
'bundles/index/scss/main.scss'
%}
    <link href="{{ asset_url }}" rel="stylesheet" type="text/css" media="screen"/>
{% endstylesheets %}

What am I missing?


Solution

  • I think you forgot to tell wich bundles to load

    assetic:
        debug:          '%kernel.debug%'
        use_controller: false
        bundles:        [ AppBundle, AnotherBundle ]
    

    Also don't forget to run assets:install

    php app/console assets:install web --symlink --relative
    

    NOTE: --symlink --relative won't work in Windows