Ruby Forum NGINX > Re: mod_strip newline substitution problem

Posted by Rt Ibmer (Guest)
on 04.05.2008 03:44
(Received via mailing list)
>This is our first released module (called 
>ngx_http_html_clean_filter_module.c) and you could read the description 
>(in spanish) at:

Thank you for posting this!

Can this be used to strip unnecessary whitespace from .js files?
For example:
   var abc = "hi there";
becomes
   var abc="hi there";

and
  if (myvar = 'a b' && x = 3) return y == j ? y + 3 : y - 1;
becomes:
  if(myvar='a b'&&x=3)return y==j?y+3:y-1;

Will it work like this?  If so, am I right to assume I can use it with 
other modules like the on-the-fly gzip so that your module will first 
strip the unnecessary whitespace from my .js files and then the gzip 
module will do its compression on the stripped version?

Thanks!!


      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now. 
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
Posted by Raul Rivero (Guest)
on 04.05.2008 11:07
(Received via mailing list)
Rt Ibmer wrote:
>    var abc="hi there";
> 
> and
>   if (myvar = 'a b' && x = 3) return y == j ? y + 3 : y - 1;
> becomes:
>   if(myvar='a b'&&x=3)return y==j?y+3:y-1;
> 

No, only deletes spaces at the beginning of the line. The module would
need a parser of JS to delete those spaces.

The target is deleted unnecesary spaces very-very fast in dynamic
elements (ex: html pages). We treated JS files like static and,
therefore, we processed them (ex: jsmin) before and store them in the
disc already clean and GZed.

Cheers,