On Jun 28, 2012, at 5:51 PM, Anthony wrote:
> Although since the files are really not dynamic, they could be aggressively 
> cached.
> 
> Good point.
> 
> @cache(request.env.path_info, time_expire=60*60*24, cache_model=cache.ram)
> def css_js():
>     response.view = '../static/%s' % '/'.join(request.args)
>     return response.render()
> 
> caches for a day. Still won't be as fast as using the web server to serve a 
> static file, though. You could also set response.headers to tell the browser 
> to cache the files, which would probably be a bigger benefit.
> 

That's what I meant. 

I did that in an earlier project, where I used semi-dynamic CSS more 
aggressively, caching colors by name, stuff like that. CSS in a web2py template 
is a pretty nice way to write CSS.

ISTR that I sent Massimo a patch (applied) to make it easier to accomplish.

Reply via email to