SASS like Plugin.options[:style] = :compressed for HAML

47 views
Skip to first unread message

ludicco

unread,
Nov 25, 2009, 3:42:35 PM11/25/09
to Haml
Hello there,
I was wondering if its possible to do the same thing as we have in
SASS while using the :compressed style and getting all the code in one
line, but for HAML this time.
I know that we have the :ugly parameter but it just discards the
indentation but not the line breaks.
So, I'm not sure if doing something like this would improve
significantly the markup reading or if between this and the :ugly
format there isn't a visible difference.
Anyone could let me know if this would be a good thing?
Is there any down sides in compressing the HTML like this, if you
don't need/want it to be human readable?

Thanks a lot

Nathan Weizenbaum

unread,
Nov 25, 2009, 4:16:56 PM11/25/09
to ha...@googlegroups.com
Eventually the :ugly option will effectively work like the :compressed style in Sass. I'm not sure it will necessarily get rid of all newlines, since the existence of whitespace (although not the amount of whitespace) is semantically relevant.


--

You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to ha...@googlegroups.com.
To unsubscribe from this group, send email to haml+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.



Mislav Marohnić

unread,
Nov 25, 2009, 5:39:01 PM11/25/09
to ha...@googlegroups.com
On Wed, Nov 25, 2009 at 21:42, ludicco <mar...@ludicco.com> wrote:
Anyone could let me know if this would be a good thing?
Is there any down sides in compressing the HTML like this, if you
don't need/want it to be human readable?

There is a reason :ugly is the only option for compressing HTML. There are a lot of downsides if you decide to simply strip newlines. One example:

    <p><em>This<em>
    is my website</p>

Browsers render any consequential amout of whitespace as a single space, and if you remove a newline here you will end up joining "This" and "is". On the other hand, if you replace a newline with a space you haven't gained anything on size.

ludicco

unread,
Nov 26, 2009, 4:56:29 AM11/26/09
to Haml
I see now, that's a good point! thank you very much!

On Nov 25, 10:39 pm, Mislav Marohnić <mislav.maroh...@gmail.com>
wrote:

Gianni Chiappetta

unread,
Nov 9, 2011, 4:22:50 AM11/9/11
to ha...@googlegroups.com
However sometimes it's incredibly useful to remove the newline whitespace for design reasons. For example, if newlines are removed between block elements, then one can replace floats with the infinitely more useful `inline-block`.
Reply all
Reply to author
Forward
0 new messages