Forum: NGINX Joining my HTML output into a single line (Google does it)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Redd V. (Guest)
on 2008-10-17 18:10
(Received via mailing list)
Can nginx help me join my HTML output into a single line?

(Google does it)

I don't wanna worry about tons of blank lines and messed up indentation.

See http://pastie.org/294626 to know what I mean.

Ok that's it, thanks guys!
Phillip B Oldham (Guest)
on 2008-10-17 18:17
(Received via mailing list)
Attachment: phill.vcf (0 Bytes)
You'll have problems with <pre /> tags if you do that.

Redd V. wrote:
>
--

*Phillip B Oldham*
The Activity People
removed_email_address@domain.invalid 
<mailto:removed_email_address@domain.invalid>

------------------------------------------------------------------------

*Policies*

This e-mail and its attachments are intended for the above named
recipient(s) only and may be confidential. If they have come to you in
error, please reply to this e-mail and highlight the error. No action
should be taken regarding content, nor must you copy or show them to
anyone.

This e-mail has been created in the knowledge that Internet e-mail is
not a 100% secure communications medium, and we have taken steps to
ensure that this e-mail and attachments are free from any virus. We must
advise that in keeping with good computing practice the recipient should
ensure they are completely virus free, and that you understand and
observe the lack of security when e-mailing us.
Almir K. (Guest)
on 2008-10-17 18:50
(Received via mailing list)
Redd V. (Guest)
on 2008-10-18 17:07
(Received via mailing list)
On Fri, Oct 17, 2008 at 4:08 PM, Phillip B Oldham
<removed_email_address@domain.invalid> wrote:
> You'll have problems with <pre /> tags if you do that.

How so?

On Fri, Oct 17, 2008 at 4:38 PM, Almir K. <removed_email_address@domain.invalid>
wrote:
> http://wiki.codemongers.com/NginxHttpStripModule

Sweet, thanks a lot mate. I hope you guys never abandon this feature.
Brett H. (Guest)
on 2008-10-18 17:51
(Received via mailing list)
On Sat, Oct 18, 2008 at 7:55 AM, Redd V. <removed_email_address@domain.invalid>
wrote:
> On Fri, Oct 17, 2008 at 4:08 PM, Phillip B Oldham
> <removed_email_address@domain.invalid> wrote:
>> You'll have problems with <pre /> tags if you do that.
>
> How so?

Because the purpose of <pre> tags is generally to keep the whitespace
intact.

http://www.w3.org/TR/html401/struct/text.html#h-9.3.4

Brett
Redd V. (Guest)
on 2008-10-18 18:04
(Received via mailing list)
On Sat, Oct 18, 2008 at 3:43 PM, Brett H. <removed_email_address@domain.invalid>
wrote:
>
> Brett
>
>

Yeah but, I never meant for it to touch what's inside tags, only
what's outside tags.
Brett H. (Guest)
on 2008-10-18 19:32
(Received via mailing list)
On Sat, Oct 18, 2008 at 8:57 AM, Redd V. <removed_email_address@domain.invalid>
wrote:
> Yeah but, I never meant for it to touch what's inside tags, only
> what's outside tags.

But you did say,

On Fri, Oct 17, 2008 at 8:57 AM, Redd V. <removed_email_address@domain.invalid>
wrote:
> I don't wanna worry about tons of blank lines and messed up indentation.

Almost all of your blank lines and indentation are inside of <html>,
or <body>, or <div>, or ... tags.  So if you want to ignore the inside
of tags then you'd only be stripping whitespace off before and after
the <html> tags.

Brett
Davy C. (Guest)
on 2008-10-18 19:35
(Received via mailing list)
mod_strip leaves intact comments as well as <pre> tags.
Phillip B Oldham (Guest)
on 2008-10-22 14:48
(Received via mailing list)
Attachment: phill.vcf (0 Bytes)
What about elements which are styled to have white-space intact using
CSS? For instance:

<div style="white-space: pre">

This is a
div            with whitespace
intact


</div>

Will mod_strip leave that alone? I'm guessing it won't. There's also
<textareas /> to take into consideration, and linked stylesheets
defining "pre" elements. Oh, and Javascript adding it on afterwards.

Not bashing here - I think mod_strip is a great idea and I've used it
myself on occasion. I've also found that it causes some headaches with
out designers as they expect copy to lay out correct when they throw a
"pre" on there and it doesn't.

Davy C. wrote:
>     But you did say,
>
>     Brett
>
>

--

*Phillip B Oldham*
The Activity People
removed_email_address@domain.invalid 
<mailto:removed_email_address@domain.invalid>

------------------------------------------------------------------------

*Policies*

This e-mail and its attachments are intended for the above named
recipient(s) only and may be confidential. If they have come to you in
error, please reply to this e-mail and highlight the error. No action
should be taken regarding content, nor must you copy or show them to
anyone.

This e-mail has been created in the knowledge that Internet e-mail is
not a 100% secure communications medium, and we have taken steps to
ensure that this e-mail and attachments are free from any virus. We must
advise that in keeping with good computing practice the recipient should
ensure they are completely virus free, and that you understand and
observe the lack of security when e-mailing us.
Jeff E. (Guest)
on 2008-10-22 17:49
(Received via mailing list)
On Fri, Oct 17, 2008 at 9:57 AM, Redd V. <removed_email_address@domain.invalid>
wrote:
> Can nginx help me join my HTML output into a single line?
>

Why bother?  What's it going to save... 100 bytes?  Gzip seems better
if you're just trying to compress.

> (Google does it)
>

And Google likely just wrote their own, since they have a very
specialized end result that's never going to have to worry about
preserving significant whitespace.
Redd V. (Guest)
on 2008-10-22 20:45
(Received via mailing list)
On Wed, Oct 22, 2008 at 3:35 PM, jeff emminger 
<removed_email_address@domain.invalid>
wrote:

> On Fri, Oct 17, 2008 at 9:57 AM, Redd V. <removed_email_address@domain.invalid>
> wrote:
> > Can nginx help me join my HTML output into a single line?
> >
>
> Why bother?  What's it going to save... 100 bytes?  Gzip seems better
> if you're just trying to compress.
>
>
For the same reason architects build their buildings according to set
sizes.

For the same reason          I    don't

       type








                               like



this
Jeff E. (Guest)
on 2008-10-22 21:14
(Received via mailing list)
>
>                                like
>
>
>
> this
>

True, but you also don't read HTML.  Machines do.
Cliff W. (Guest)
on 2008-10-22 23:48
(Received via mailing list)
On Wed, 2008-10-22 at 18:36 +0200, Redd V. wrote:
>         if you're just trying to compress.
>
>
>
>
>
>
>                                like
>
>
>
> this

That makes no sense.  If anything this is an argument against having
your HTML all on one long line.  If you are looking for human-readable
HTML formatting you should consider tidylib or just make sure you are
generating formatted output to start with.

For the record, I consider lossless compression (e.g. gzip) much more
reliable than whitespace collapsing if you are looking to conserve
bandwidth.  It's more effective, plus it's nearly impossible to debug
layout issues if your output gets mangled before you see it.

Cliff
Redd V. (Guest)
on 2008-10-23 00:29
(Received via mailing list)
On Wed, Oct 22, 2008 at 9:38 PM, Cliff W. <removed_email_address@domain.invalid> 
wrote:

>
> Cliff


Yeah you're right, I could use Tidy but it's damn slow. If I join
everything
into a single line, there won't be any HTML formatting anymore and I'll
have
no more worries :-)
This topic is locked and can not be replied to.