I'm compressing my javascripts via assetic (block in twig for all scripts in one dir) which works fine in prod mode. Now i want to use the debug mode for my prod env, so i switch assetic to debug in the config, clear the cache and dump the assets with debug on.
This works for some javascripts but not all. Symfony adds a suffix number to them which is higher (by one) on the website (javascript tag) in opposite to the real file. Sometimes clearing the cache and dumping again solved the problem, but noot this time.
For example: It dumps: /web/js/main_part_3_jquery-ui_6.js But uses: /web/js/main_part_3_jquery-ui_1.js
So how can i solve this?
Edit: The wron suffix doesn't appear on the first request to the site after cleaning the cache.
Since app/console assetic:dump
is sensible for cached yml
files - you should clear the cache for dumping assets each time you change configuration.
Best of all is to do it in this sequence:
rm -rf app/cache/*
app/console assets:install web
app/console assetic:dump
Of course, with debug keys, needed environments and so on
I had a similar problem of multiple generated assets and symfony not including the good one on display.
It was because of busting cache enabled in my case, and it was apparently misconfigured. (apparently it's usefull when you need a new version of your files, for example when you update your .js in dev but don't want to break prod )
So disabling it in config.yml fixed it.
assetic: workers: cache_busting: enabled: false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With