Bruno
Bruno

Reputation: 904

Symfony JavaScript asset problems (double project name)

I'm trying to deploy my Symfony Projects. My Problem is that on the deployment server all links for the JavaScript files are broken.

On my development server the links look like : /js/token.js

On my production server the links look like: /projectname/projectname/js/token.js.

I already cleared the cache and dumped all assets.

Does somebody know how to fix it or where to look?

Bruno

p.s.:

{% javascripts '@Bundle/Resources/public/js/javascriptfile.js'%}
  <script type='text/javascript' src="{{ asset( asset_url ) }}"></script>
{% endjavascripts %} 

Upvotes: 0

Views: 106

Answers (2)

malcolm
malcolm

Reputation: 5542

Add output option:

{% javascripts '@Bundle/Resources/public/js/javascriptfile.js'
    output='js/javascriptfile.js' %}
    <script type='text/javascript' src="{{ asset_url }}"></script>
{% endjavascripts %} 

Upvotes: 0

xurshid29
xurshid29

Reputation: 4210

Here is the documentation about Assetic,

Example from that page:

{% javascripts '@AppBundle/Resources/public/js/*' %}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}

So, I think it should work if you change {{ asset( asset_url ) }} to {{ asset_url }}

Upvotes: 1

Related Questions