Forum OpenACS Development: Re: css and js versioning by url to avoid caching old ones

Collapse
Posted by Gustaf Neumann on
I would recommend to combine this effort with the
following items:

 a) use expires header (via e.g. "ns_setexpires 300000")
    for css and js files (and maybe static images like 
    icons as well)

 b) add versioning via file-names (e.g. lists-5-3.css).
    when the files change in a local release, the 
    numbers should increment, when using pattern
    like *-5-3.css, it can be automated

The advantage of this approach is that the
user experience is much better, once the 
pages are cached. The site appears much quicker, 
oacs has to serve much less simple requests. 
Due to the  exipires header, the static files 
do not have to be validated and the page load
latency is significantly reduced.

For more background information, see
http://open.yahoo.com/performance/rules.html#expires

We are using expires setting in learn@WU since 
at least half a year with very good success (modified
the request processor to serve "resources" with
a three hours expires).

-gustaf neumann
I agree, we should try to include this in the toolkit, can you post your patch Gustaf? (looking forward to implement these stuff in Galileo)
Any experience with Etags?
http://open.yahoo.com/performance/rules.html#etags

Versioning of CSS & .js might be better with numbers as suggested in yahoo best practices, while the approach that Miguel suggest is more suitable for dynamic components (yahoo again). Anyway, certainly we need to adopt versioning in order to smoothly introduce any changes in css / .js in production sites.

BTW, anyone with idea on how headers flush can be acomplished?
http://open.yahoo.com/performance/rules.html#flush

Collapse
Posted by Miguel Cordova on
I'm going to work on OpenACS 5.3 with that issues, due to that version is on our production server right now. That way, it could be used in older oacs versions (with no template::head api function and so on)

Once I had fixed all bugs, I could export that work to oacs 5.4 with its new templating system.

Gustaf, about "add versioning via file-name", it forces to rename files in CVS, doesn't it? or maybe it's a link to real filename?.

Collapse
Posted by Don Baccus on
Putting in the expires setting sounds like a good idea, do you want to TIP it?