Reputation: 66
I've been having problems getting the Assetic cache buster up and running on our production server. Symfony2 (2.4) is configured to use the cache buster only when in production. Everything works like a charm on our development machines. On the production server however, Assetic generates filenames like below when dumping assets:
/web/js/starapple.min-c875bb6-7df71b9.js
And embeds a link looking like:
http://starapple.nl/js/starapple.min-c875bb6.js
This invalidates all css and js asset links on our production server. Has anyone encountered this problem in production and if so, what's your solution?
UPDATE
The assetic configuration in config.yml:
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles:
- FrameworkBundle
- SecurityBundle
- TwigBundle
- MonologBundle
- SwiftmailerBundle
- DoctrineBundle
- AsseticBundle
- StarAppleCRMBundle
- StarAppleCalendarBundle
- StarAppleChatBundle
- StarAppleWebBundle
filters:
sass: ~
compass:
plugins: ['zen-grids']
less:
node: /usr/local/bin/node
node_paths: [/usr/local/lib/node_modules]
apply_to: "\.less$"
cssrewrite: ~
uglifyjs2:
bin: /usr/local/bin/uglifyjs
uglifycss:
bin: /usr/local/bin/uglifycss
assets:
bootstrap_css:
inputs:
- %kernel.root_dir%/../vendor/twbs/bootstrap/less/bootstrap.less
- %kernel.root_dir%/../vendor/twbs/bootstrap/less/responsive.less
filters:
- less
- cssrewrite
output: css/bootstrap.css
bootstrap_js:
inputs:
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-transition.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-alert.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-button.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-carousel.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-collapse.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-dropdown.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-modal.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-tooltip.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-popover.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-scrollspy.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-tab.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-typeahead.js
- %kernel.root_dir%/../vendor/twbs/bootstrap/js/bootstrap-affix.js
output: js/bootstrap.js
And enabling the cache buster in config_prod.yml:
assetic:
workers:
cache_busting: ~
Upvotes: 2
Views: 362