Re: mod_strip newline substitution problem

Hi Evan

The problem is that I can’t replace newlines before end tags with a space:

Is that going to make it even more challenging to add support for
removing unnecessary spaces from JavaScript files? Would love to see
support for that one day. Currently we are doing this with a filter at
the web server level and I bet doing it at the nginx level would be much
more efficient.

  ____________________________________________________________________________________

Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

could also control it from a “build” level

do some minifying or javascript compression, file combining and anything
else

Rt Ibmer <[email protected]…> writes:

Hi Evan

The problem is that I can’t replace newlines before end tags with a space:

Is that going to make it even more challenging to add support for removing
unnecessary spaces from JavaScript files? Would love to see support for
that
one day. Currently we are doing this with a filter at the web server
level and
I bet doing it at the nginx level would be much more efficient.

Yes. The module will need to be rewritten to parse other languages. I’d
like to
use Ragel, a state-machine generator that operates on data buffers.

http://www.cs.queensu.ca/~thurston/ragel/

Evan

Hi all,

We (soitu.es) has a module which cleans HTML and inserts blocks of HTML.

This is our first released module (called
ngx_http_html_clean_filter_module.c) and you could read the description
(in spanish) at:

 http://www.soitu.es/soitu/2008/04/28/met/1209378259_661127.html

An usage example is:

location / {
html_clean_active on;

 # Pixel counter and common JS to all pages.
 html_clean_pxlcntrblock '<div style="display:none">\

\

';
 # Only common JS, no pixel counter
 html_clean_xcldpxlcntrblock '<div style="display:none">\
';

}

A few lines about

  • Removes all white spaces at the begining of lines and empty lines.

  • Removes all HTML comments with a pattern like:

    So, the following comments is deleted:

    But not the:

  • Blocks surrounded by #IB and #EB are served without modifications:

    this will be
    served without
    been modified

  • The text defined in “html_clean_pxlcntrblock” is inserted after

tag (we used to count pixels and common JS includes). The problem is that we have pages which could not be counted (examples: iframes or frames), so you'll need a before and the text defined in "html_clean_xcldpxlcntrblock" will be inserted.

We are using in our production NGINX servers.

Cheers,

Hi Raul,
Your module works fine :slight_smile: (also against nginx nginx-0.6.30).
I’m using it on my production server with mod_stripe to cleanup fastcgi
output code :slight_smile:

Thanks,
Tomek

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs