perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boysenberry Payne <boysenbe...@humaniteque.com>
Subject Re: RFC: Apache2::Filter::Minifier::JavaScript
Date Wed, 19 Sep 2007 17:40:36 GMT
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?

-bop

On Sep 19, 2007, at 12:24 PM, 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)...
>
> Am thinking along the lines of something that you'd set up in your  
> Apache
> config like:
>
> 	<FilesMatch "\.js$">
> 		PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript
> 		PerlSetVar MINIFIER_CACHE_ROOT /path/to/your/cache/dir
> 	</FilesMatch>
>
> Results would be cached to disk, so that we didn't have to re- 
> minify the JS
> files on each and every request.  Obviously, if the original file  
> changes,
> the cached copy would be considered invalid.
>
> Seeing the above makes me wonder, though... is there a way to set  
> up a Perl
> output filter for -just- specific MIME-Types?  Similarly to
> AddOutputFilterByType, but for mod_perl handlers?
>
> Thought I'd ask and see if others would find something like this  
> useful, or if
> you've got suggestions on other ways to do this.  I know that I  
> could just
> minify all the JS files on disk, but it'd be a whole lot simpler to  
> just set
> it up as a filter and not have to worry about it.  Also means that  
> I could
> turn the filter off during testing and be able to work with the un- 
> minified
> JS.
>
> Also thinking that an Apache2::Filter::Minifier::CSS module would  
> be possible
> using CSS::Minifier; basically same thing but for CSS instead.
>
> -- 
> Graham TerMarsch


Mime
View raw message