How can one cache bust files referenced in a LESS file when using Symfony2, Twig, and Assetic?
Posted
by
user3719083
on Stack Overflow
See other posts from Stack Overflow
or by user3719083
Published on 2014-06-08T06:15:52Z
Indexed on
2014/06/08
9:24 UTC
Read the original article
Hit count: 242
I have a web site built on Symfony2 which uses twig templates, LESS, and assetic.
In order to cache bust assets, I'm simply using this in my config.yml:
framework:
templating:
engines: ['twig']
assets_version: 'asset-version-here'
And then I use the asset()
function to load the asset and the cache busting is handled for me.
However, the concern I have is when I load my LESS (css) file, there are references to other files, and I would like to know how these files can be cache busted as well.
Example:
.someSelector { background:url('../images/filename.png'); }
How can I make sure that the referenced file, filename.png is cache busted upon deployment?
The asset files referenced in Twig using asset() are cache busted automatically upon deployment (I use a deployment script hook that updates the assets_version in the framework's config), but those referenced in a stylesheet are not.
How can I do this?
© Stack Overflow or respective owner