httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerome Renard <>
Subject Re: Minification of js files.
Date Wed, 04 Nov 2009 07:05:25 GMT
Hello :)

On Wed, Nov 4, 2009 at 5:42 AM, Jaysingh Samuel
<> wrote:
> Hi,
> Instead of minifying each of the javascript file separately and then using, is there
a way of embedding the jsmin/(stripping of the blank lines) in the filter module of the apache
so that the js file will be minified on the fly.

Since there is a jsmin.c available here : I think you could bundle
it in your module and use the JSMin API.
However it might not make much sense to minify a javascript for every
request. Do your Javascript files change that often ?
I think you have to choose between the two following solutions :

1. To pre minify javascript files by running a shell/ant/Make script
calling jsmin and push them in your HTTP directory
2. To minify Javascript files by embedding jsmin.c in a custom output
filter module so it is done on the fly

Pro and cons of option 1 are :
Pro : easy to do, easy to maintain
Cons : you have to run it after each update of you JS file(s), i.e it
is not done on the fly

Pro and cons of option 2 are :
Pro : "minification" is done on the fly
Cons : longer to create (you have to write C code), harder to
maintain, will use much more server resources than option 1

It is up to you to make your decision based on your context.

Hope that helps


View raw message