Rails time stamps on images in CSS

Posted by brad on Server Fault See other posts from Server Fault or by brad
Published on 2009-09-08T14:00:18Z Indexed on 2010/03/16 10:06 UTC
Read the original article Hit count: 276

Filed under:
|
|

Just posted this on Stack but realized it may be more appropriate here:

So Rails time stamping is great. I'm using it to add expires headers to all files that end in the 10 digit timestamp. Most of my images however are referenced in my CSS. Has anyone come across any method that allows for timestamps to be added to CSS referenced images, or some funky re-write rule that achieves this? I'd love for ALL images in my site, both inline and in css to have this timestamp so I can tell the browser to cache them, but refresh any time the file itself changes.

I couldn't find anything on the net regarding this and I can't believe this isn't a more frequently discussed topic.

I don't think my setup will matter because the actual expiring will hopefully happen the same way, based on the 10 digit timestamp, but I'm using apache to serve all static content if that matters

© Server Fault or respective owner

Related posts about rails

Related posts about apache