Forum: Ruby on Rails caching of javascript and stylesheets

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jeff C. (Guest)
on 2006-05-25 18:55
Is there a standard way to make sure a client's web browser pulls the
latest version of your style sheet or javascript file instead of using a
cached one?   We are currently using a tedious way where we add a
version number to the file (e.g. screen-v12.css) and when Rails boots up
it finds the latest version in the style sheet folder.   On the other
hand, I have seen Basecamp append some kind of query string to the
include href, e.g. href="/stylesheets/screen.css?1147466741".  Not sure
what their logic is for coming up with that query string parameter.

Anyway, it would be nice if there were some standard way to deal with
this problem. Is there one?  What are other people doing?

thanks,
Jeff
Harvey B. (Guest)
on 2006-05-25 19:07
(Received via mailing list)
There a plugin called asset_timestamping which will do what you want.
Harvey


On 25/5/06 15:55, "Jeff C." <removed_email_address@domain.invalid> wrote:

> this problem. Is there one?  What are other people doing?
>
> thanks,
> Jeff
>


This e-mail has been scanned for all viruses by MessageLabs.
Danny B. (Guest)
on 2006-05-25 19:24
Harvey B. wrote:
> There a plugin called asset_timestamping which will do what you want.
> Harvey
>
>

Actually this asset timestamping ability is built into Rails now, since
actionpack 1.12.1, I believe.  Unfortunately, there's not a very fine
grain of control over it (it's either on for everything, or nothing),
but it's there nonetheless.

Here is an excellent blog post on it:

http://hypsometry.com/blog/on-browser-caching-asse...

- Danny
Harvey B. (Guest)
on 2006-05-25 19:57
(Received via mailing list)
Danny
Thanks for the info
Harvey


On 25/5/06 16:24, "Daniel B." <removed_email_address@domain.invalid> wrote:

>
> Here is an excellent blog post on it:
>
> http://hypsometry.com/blog/on-browser-caching-asse...
>
> - Danny


This e-mail has been scanned for all viruses by MessageLabs.
This topic is locked and can not be replied to.