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.
F745d7fbe0dbe947aa1082aabb2b6a4f?d=identicon&s=25 Redd Vinylene (Guest)
on 2008-10-17 16: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!
4eac1f7d1ff86ab17e7a9dbe6af0b44b?d=identicon&s=25 Phillip B Oldham (Guest)
on 2008-10-17 16:17
(Received via mailing list)
Attachment: phill.vcf (262 Bytes)
You'll have problems with <pre /> tags if you do that.

Redd Vinylene wrote:
>
--

*Phillip B Oldham*
The Activity People
phill@theactivitypeople.co.uk <mailto:phill@theactivitypeople.co.uk>

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

*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.
F850da95064ee4b7eae9caff255f6224?d=identicon&s=25 Almir Karic (Guest)
on 2008-10-17 16:50
(Received via mailing list)
F745d7fbe0dbe947aa1082aabb2b6a4f?d=identicon&s=25 Redd Vinylene (Guest)
on 2008-10-18 15:07
(Received via mailing list)
On Fri, Oct 17, 2008 at 4:08 PM, Phillip B Oldham
<phill@theactivitypeople.co.uk> wrote:
> You'll have problems with <pre /> tags if you do that.

How so?

On Fri, Oct 17, 2008 at 4:38 PM, Almir Karic <almir@kiberpipa.org>
wrote:
> http://wiki.codemongers.com/NginxHttpStripModule

Sweet, thanks a lot mate. I hope you guys never abandon this feature.
Bbe9d28c3b9be91b232f737a85532322?d=identicon&s=25 Brett Hoerner (Guest)
on 2008-10-18 15:51
(Received via mailing list)
On Sat, Oct 18, 2008 at 7:55 AM, Redd Vinylene <reddvinylene@gmail.com>
wrote:
> On Fri, Oct 17, 2008 at 4:08 PM, Phillip B Oldham
> <phill@theactivitypeople.co.uk> 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
F745d7fbe0dbe947aa1082aabb2b6a4f?d=identicon&s=25 Redd Vinylene (Guest)
on 2008-10-18 16:04
(Received via mailing list)
On Sat, Oct 18, 2008 at 3:43 PM, Brett Hoerner <bretthoerner@gmail.com>
wrote:
>
> Brett
>
>

Yeah but, I never meant for it to touch what's inside tags, only
what's outside tags.
Bbe9d28c3b9be91b232f737a85532322?d=identicon&s=25 Brett Hoerner (Guest)
on 2008-10-18 17:32
(Received via mailing list)
On Sat, Oct 18, 2008 at 8:57 AM, Redd Vinylene <reddvinylene@gmail.com>
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 Vinylene <reddvinylene@gmail.com>
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
C62eb10afff640cb0fa31cfaa07f6715?d=identicon&s=25 Davy Campano (Guest)
on 2008-10-18 17:35
(Received via mailing list)
mod_strip leaves intact comments as well as <pre> tags.
4eac1f7d1ff86ab17e7a9dbe6af0b44b?d=identicon&s=25 Phillip B Oldham (Guest)
on 2008-10-22 12:48
(Received via mailing list)
Attachment: phill.vcf (262 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 Campano wrote:
>     But you did say,
>
>     Brett
>
>

--

*Phillip B Oldham*
The Activity People
phill@theactivitypeople.co.uk <mailto:phill@theactivitypeople.co.uk>

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

*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.
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2008-10-22 15:49
(Received via mailing list)
On Fri, Oct 17, 2008 at 9:57 AM, Redd Vinylene <reddvinylene@gmail.com>
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.
F745d7fbe0dbe947aa1082aabb2b6a4f?d=identicon&s=25 Redd Vinylene (Guest)
on 2008-10-22 18:45
(Received via mailing list)
On Wed, Oct 22, 2008 at 3:35 PM, jeff emminger <jemminger@gmail.com>
wrote:

> On Fri, Oct 17, 2008 at 9:57 AM, Redd Vinylene <reddvinylene@gmail.com>
> 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
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2008-10-22 19:14
(Received via mailing list)
>
>                                like
>
>
>
> this
>

True, but you also don't read HTML.  Machines do.
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2008-10-22 21:48
(Received via mailing list)
On Wed, 2008-10-22 at 18:36 +0200, Redd Vinylene 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
F745d7fbe0dbe947aa1082aabb2b6a4f?d=identicon&s=25 Redd Vinylene (Guest)
on 2008-10-22 22:29
(Received via mailing list)
On Wed, Oct 22, 2008 at 9:38 PM, Cliff Wells <cliff@develix.com> 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.