Jake N
Jake N

Reputation: 10583

Symfony2 asset_version being added twice

My config.yml looks like so

framework:
    templating:
        engines: ['twig']
        assets_version: 2

And my twig template has this

{% block stylesheets %}
    {% stylesheets  output='css/compiled/main.css'
    '@AppBundle/Resources/public/css/bootstrap.min.css'
    '@AppBundle/Resources/public/css/main.css'
    %}

    <link rel="stylesheet" type="text/css" media="screen" href="{{ asset(asset_url) }}" />
    {% endstylesheets %}
{% endblock %}

This works but the output has the version param twice.

/css/compiled/main.css?v=2?v=2

I have no idea why this is happening and I am not overriding the assets_version_format either. I even searched my whole project for it just in case.

This only occurs though in my production env, dev is fine and works correctly with just one query param.

Upvotes: 2

Views: 81

Answers (1)

Carlos Granados
Carlos Granados

Reputation: 11351

It should be:

<link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}" />

(do not put asset_url within an asset() function)

Upvotes: 4

Related Questions