I want to cache bust background images in my CSS. So if my original style is:
.one {
background: url(image.png);
}
A string can be added:
.one {
background: url(image.png?1234);
}
Or the file name could be changed:
.one {
background: url(image-1234.png);
}
Rather than using a random generator or a timestamp id like to use a hash of the image file so that the cache is only busted when needed (when the file has actually changed).
Im using SASS and Gulp so I could use Gulp Cache Buster and Gulp Hasher:
https://github.com/disintegrator/gulp-hasher
https://github.com/disintegrator/gulp-cache-buster
The issue I have with these is that it looks like you need to modify your SASS. So if you start with this:
.logo {
background: url(assets/images/logo.svg);
}
You need to change it to this:
.logo {
background: url(ASSET{assets/images/logo.svg});
}
I want to keep my SASS nice and clean and not modify it in this way. Is this possible?