Graham TerMarsch wrote: > On Thursday 20 September 2007 6:45 am, Geoffrey Young wrote: >> Graham TerMarsch wrote: >>> I've been working on some projects needing JS minification recently and >>> wanted to ping others and find out if anyone else would find it useful to >>> have a mod_perl2 filter that auto-minified your JS (using >>> JavaScript::Minifier)... >> see also >> >> http://search.cpan.org/src/GEOFF/Apache-Clean-2.00_7/ >> http://www.perl.com/pub/a/2003/04/17/filters.html > > I'd seen HTML::Clean before, and had considered making a separate minifier > module along those lines. I actually hadn't seen that version of it, though; > I missed the dev releases. > > Thanks for the pointer though Geoff, I'll have a look at the latest > Apache::Clean release and see what useful tidbits of info are in there that > I've missed.
the parts you'll be interested in are the parts you were asking about, like only running for a specific content-type. it also has a basic framework for using the streaming filter API and dealing with filter context, as well as handling http compliance (removing the content-length header, for example). in all, you ought to be able to use the base of it and swap the HTML::Clean innards for the purifier of your choice. good luck. --Geoff