twolfson/grunt-spritesmith

Cache problem on loading the image sprite

Closed this issue · 2 comments

Hello,

I often have the problem of cache to load the image sprite when I update some image.
When upgrading a website with new images in my image sprite, users have display problem due to new positions about the cached image in their browser.
The ideal solution would be to put a parameter in the url of the generated sprite with the timestamp of the moment that was generated variable:

Currently:
@photo-image: '../build/images/sprite.png';

My suggestion:
@photo-image: '../build/images/sprite.png?20140313183824';

Thereby prevent the caching of new sprites generated respecting the cache when needed.

Thanks in advance.

Sorry, I solved the problem adding this on Gruntfile.js:

...
imgPath: '../build/images/sprite.png?' + (new Date().getTime()),
...

Glad this got sorted out =)