perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham TerMarsch <modp...@howlingfrog.com>
Subject Re: RFC: Apache2::Filter::Minifier::JavaScript
Date Wed, 19 Sep 2007 17:49:25 GMT
On Wednesday 19 September 2007 10:40 am, Boysenberry Payne wrote:
> I could use something like this.  Right now I use Toolkit Template to
> build from.
> It already caches the JS file loaded from disk.  I would want to then
> put it through
> the minifier process and cache then serve.  Would you module allow
> for this?

That'd be the idea... it'd just be a generic "output filter" that you'd have 
to hook up yourself into your existing JS pipeline.  In my initial example I 
used <FilesMatch> to do it, but you could hook it up anywhere that you can 
set up a PerlOutpuFilterHandler.  It'd just take the JS that it was provided, 
minify it, then cache the minified version.  On subsequent requests, it'd 
(somehow) figure out that the cached copy was valid and then either use the 
cached copy or re-minify+re-cache as necessary.

If we're dealing with -dynamically- generated JS, though, then I'll need to 
think a bit more about how I deal with "is our cached copy valid/stale?", as 
that'd be done differently than if just serving static JS files.  I'll have a 
look at that, though, as that's a good use case.  I'd initially thought of 
using the "r->finfo->inode()" as a cache key, but I don't think that's there 
if I'm being handed dynamically generated JS.

-- 
Graham TerMarsch

Mime
View raw message