If you are talking last-modified vs expires, you want expires, as last-modified will still do a server request (that should return 304). You should be able to get your webserver to send an expires header.
Of course that doesn't force a reload the way a ?timestamp does, but short of generating the css dynamically, there isn't much you can do about that. You could probably write a rake task that parses the CSS, and inserts the timestamp on deployment. ---------------------------------------------- Myles Eftos Mobile: +61-409-293-183 MadPilot Productions - Created to be Different URL: http://www.madpilot.com.au Phone: +618-6424-8234 Fax: +618-9467-6289 Try our time tracking system: 88 Miles! http://www.88miles.net > -----Original Message----- > From: [email protected] [mailto:rails- > [email protected]] On Behalf Of Mark Mansour > Sent: Wednesday, 16 September 2009 11:28 PM > To: [email protected] > Subject: [rails-oceania] Re: Adding timestamps to image refs in CSS and > JS > > > Hey Myles, > > You have answered my question. Thankyou. > > This is one of those areas I should have been clearer in. The desired > effect I'm going for is that the static assets are requested one per > deployment (that is good enough for me right now). currently I'm > adding etags which still have the browser send requests to the server, > in which case the server sends back a 304 Not Modified. Which is > better than retransmitting the image each time, but I'd like to remove > the entire round trip. > > What I want is the effect that timestamps with an expires/last > modified set like a year in the future (I can never remember whether > it is expires or last-modified) so that the same asset is brought out > of browser cache rather than re-querying the server and getting a 304. > So I can do this for normal rails assets that have the timestamp > thrown on the end, but I'm not sure how to do it with the images > inside my JS and CSS files. I hope that is a bit clearer. > > Mark > > On Thu, Sep 17, 2009 at 1:00 AM, Myles Eftos <[email protected]> > wrote: > > > > With a server that adds etags. Apache + Passenger does nicely > > > > > > > > ---------------------------------------------- > > > > Myles Eftos > > > > Mobile: +61-409-293-183 > > > > > > > > MadPilot Productions - Created to be Different > > > > URL: http://www.madpilot.com.au > > > > Phone: +618-6424-8234 > > > > Fax: +618-9467-6289 > > > > > > > > Try our time tracking system: 88 Miles! > > > > http://www.88miles.net > > > > > > > > From: [email protected] [mailto:rails- > [email protected]] On Behalf Of Mark Mansour > > Sent: Wednesday, 16 September 2009 10:44 PM > > To: [email protected] > > Subject: [rails-oceania] Adding timestamps to image refs in CSS and > JS > > > > > > > > So, I'm still running old school and using static css and js in > /public. My CSS files have refs to images and the don't have a > timestamps appended. > > > > > > > > > > > > i.e. .my_class { background:url(/images/blah.png); } > > > > becoming > > > > .my_class { background:url(/images/blah.png?1111111111); } > > > > > > > > How are you guys doing that? > > > > > > > > Mark > > > > -- > > Mark Mansour > > [email protected] > > http://agilebench.com/ > > > > > > > > > -- > Mark Mansour > [email protected] > http://agilebench.com/ > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en -~----------~----~----~----~------~----~------~--~---
