Xavi
Xavi

Reputation: 205

Conflicts with Symfony2 AsseticBundle and the 'non existing routes'

Assetic doesn't work very wells with this tag:

{% stylesheets output='/style/app.css'
    '@VendorBundle/Resources/style/main.css'
%}
    <link rel="stylesheet" href="{{ asset_url }}"/>
{% endstylesheets %}

If I use it, it's like Assetic doesn't know what to do with this. In config_dev use_controller is true. I can't find what I'm doing wrong. I just get this:

An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "_assetic_aca6c7a_0" as such route does not exist.") in "VendorBundle:Section:template.html.twig".

Maybe some cache issue? I don't know what I can try...

Upvotes: 4

Views: 2946

Answers (3)

txurdi
txurdi

Reputation: 31

I had a similar problem, solved by adding a route in routing_dev.php

_assetic:
    resource: .
    type:     assetic

Upvotes: 0

Oleksii Zymovets
Oleksii Zymovets

Reputation: 740

I had same problem. In my case clearing app/cache and app/logs solved the issue.

Upvotes: 5

Roukmoute
Roukmoute

Reputation: 779

Just add the name of your bundle in the config.yml file, so it can have the rights to create files.

assetic:
    bundles:        [ VendorBundle ]

Upvotes: 3

Related Questions