Spea / SpBowerBundle

Symfony2 Bundle to handle asset dependencies with bower
231 stars 44 forks source link

"The template does not support the "bundle" parameter." #119

Closed pkalisz closed 9 years ago

pkalisz commented 9 years ago

I followed every single step from documentation. Everything works great right after app/console cache:clear, but second request ends with:

An exception has been thrown during the compilation of a template ("The template does not support the "bundle" parameter.") in "base.html.twig".

My base.html.twig looks like this:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>{% block title %}Welcome!{% endblock %}</title>
        {% stylesheets
            "@bootstrap_css" %}
            <link rel="stylesheet" href="{{ asset_url }}" />
        {% endstylesheets %}
        {% block stylesheets %}{% endblock %}
        <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
    </head>
    <body>
        {% block body %}{% endblock %}
        {% block javascripts %}{% endblock %}
    </body>
</html>

Any ideas what is wrong?

Spea commented 9 years ago

This is quite a confusing error, since this only happens when the bundle for a template is null.

I need some more information to help you there.

Thanks in advance

davepowell commented 9 years ago

We just ran into the same issue upgrading from Symfony 2.5.8 to 2.5.9. Reverting back to 2.5.8. cured the problem for us.

krzysztof-alboszta commented 9 years ago

I've ran into the same issue after accidental upgrade to 2.5.9

Spea commented 9 years ago

I only tested this with 2.6.* will take a look into this.

Spea commented 9 years ago

I'm still not able to reproduce it. Please be so kind and post the following information:

krzysztof-alboszta commented 9 years ago

I think It is related with this PR which was taken into the latest version of 2.3.24, 2.5.9 and the newest 2.6.* branches https://github.com/symfony/symfony/pull/12894 as @stof mentioned in https://github.com/symfony/AsseticBundle/issues/331 there is fix for that in dev version of AsseticBundle fix for that should be to use only bundle:folder:template.format.engine notation when including templates

Spea commented 9 years ago

Ah I see. Good to know I didn't broke something :)

krzysztof-alboszta commented 9 years ago

in my case the problem was that I used correctly extending main template as {% extend '::layout.html.twig' %} but in that file (provided in app/Resources/views/) i had this code: {% extends app.user ? "base_secure.html.twig" : "base.html.twig" %} It works before, now It require to have the bundle notation like {% extends app.user ? "::base_secure.html.twig" : "::base.html.twig" %}

@davepowell check your code for similar usage

evheniy commented 9 years ago

The same problem after updating from 2.5 to 2.6.3 app/console twig:lint src

{% block javascripts %}
    {{ parent() }}
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true"></script>
    {% javascripts
    '@WorkDefaultBundle/Resources/public/js/chat_client.js'
    filter='uglifyjs2' %}
    <script src="{{ static_img_url }}{{ asset_url }}"></script>
    {% endjavascripts %}
{% endblock %}

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    globals:
        static_img_url: %static_img_url%

# Assetic Configuration
assetic:
    debug:          %kernel.debug%
    use_controller: false
    bundles:        [ WorkDefaultBundle, WorkMobileBundle, TwigBundle ]
    filters:
        uglifyjs2:
            bin: /usr/local/bin/uglifyjs
        uglifycss:
            bin: /usr/local/bin/uglifycss
krzysztof-alboszta commented 9 years ago

I think for the {% javascripts %} tag (and perhaps for {% stylesheets %}) the only solution is to take the dev version of symfony/assetic bundle (composer require symfony/assetic-bundle:~2.5-dev) as the change that fix this issue is not yet merged into stable version

evheniy commented 9 years ago

Great. Thank you. It works. (and for stylesheets too)

sonu27 commented 9 years ago

Thank you! Hopefully they merge it in stable soon.

karser commented 9 years ago

Same issue when update 2.6.1 => 2.6.3 workaround is

"symfony/symfony": "~2.6",
"symfony/assetic-bundle": "dev-master",
koflerdavid commented 9 years ago

Just an observation. I ran into the same problem today (Symfony v2.3.34, Assetic v1.1.1, AsseticBundle v2.3.0), but "resolved" it by using the <Bundle>:<Folder>:<template> notation for referencing the template (in the controller) instead of @<Bundle>/<Folder>/<template> .

stof commented 9 years ago

use the dev version of AsseticBundle (the master branch) to get the fixed version. I will release it this evening

ousmaneNdiaye commented 9 years ago

I got the same error after uppgrading from 2.5.8 to 2.5.9, it appears in console when I try to use the translation:update command. Using assetic dev-master version did not fix it (in addition using dev-master versions is considered as a critical violation according to sensio insight)

stof commented 9 years ago

@ousmaneNdiaye AsseticBundle 2.6.0 and 2.6.1 have been released in the meantime

stof commented 9 years ago

And I was talking about the AsseticBundle version, not the Assetic version

ousmaneNdiaye commented 9 years ago

@stof ok Thank you I will check it out.

seb2411 commented 9 years ago

@stof, and for the 2.3.* branch ? There are some updates ?

stof commented 9 years ago

@seb2411 no, because the 2.6 version of AsseticBundle is compatible with Symfony 2.3+ so I'm not maintaining multiple branches in parallel. People should just update to the latest version.

xammeil commented 9 years ago

how to upgrade the symfony version

Spea commented 9 years ago

Since this issue is fixed, I'm going to close this ticket