Compass / compass

Compass is no longer actively maintained. Compass is a Stylesheet Authoring Environment that makes your website design simpler to implement and easier to maintain.
http://compass-style.org
Other
6.72k stars 1.18k forks source link

Option to include line breaks in compressed output #577

Closed davidchambers closed 12 years ago

davidchambers commented 12 years ago

At the moment I have a Sass file of around 1000 lines, which generates a CSS file of around 32 KiB. Each time I commit a change I first run compass compile --output-style compressed. The problem with this approach is that even a one-line change results in a 64 KiB diff, since one huge line is modified in the CSS file.

I realize that it's possible to avoid this problem by not including the generated file in the repository. There are two advantages to committing generated output, though. First, it's then easy to avoid accidentally introducing changes caused by using different versions of the compiler (on different machines, say, or following an update). Secondly, it doesn't require that Ruby be installed on the server.

I believe the benefits of having --output-style compressed place each block on a separate line outweigh the cost of the extra bytes (the \ns).

a{border-bottom:1px dotted #bada55;color:#bada55}a:hover{border-bottom-style:solid;text-decoration:none}

The above would become:

a{border-bottom:1px dotted #bada55;color:#bada55}
a:hover{border-bottom-style:solid;text-decoration:none}

If it's decided that --output-style compressed should not change, perhaps a --line-breaks flag or a fifth --output-style could be added.


It's quite possible that this is a Sass issue rather than a Compass one. If so I'm happy to close it here and raise it in the appropriate place.

ttilley commented 12 years ago

This already exists, for the most part, with the :compact output option: http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#output_style

Compact style takes up less space than Nested or Expanded. It also draws the focus more to the selectors than to their properties. Each CSS rule takes up only one line, with every property defined on that line. Nested rules are placed next to each other with no newline, while separate groups of rules have newlines between them.

The only difference from what you propose, as far as I can tell, is that there is an additional newline between groups. So every so often you'll have two newlines instead of one.

scottdavis commented 12 years ago

Well I always commit my compiled Stylesheets and I have a script that will compile for production and rsync when I deploy

Sent from my iPhone

On Oct 2, 2011, at 8:12 PM, David Chambersreply@reply.github.com wrote:

At the moment I have a Sass file of around 1000 lines, which generates a CSS file of around 32 KiB. Each time I commit a change I first run compass compile --output-style compressed. The problem with this approach is that even a one-line change results in a 64 KiB diff, since one huge line is modified in the CSS file.

I realize that it's possible to avoid this problem by not including the generated file in the repository. There are two advantages to committing generated output, though. First, it's then easy to avoid accidentally introducing changes caused by using different versions of the compiler (on different machines, say, or following an update). Secondly, it doesn't require that Ruby be installed on the server.

I believe the benefits of having --output-style compressed place each block on a separate line outweigh the cost of the extra bytes (the \ns).

a{border-bottom:1px dotted #bada55;color:#bada55}a:hover{border-bottom-style:solid;text-decoration:none}

The above would become:

a{border-bottom:1px dotted #bada55;color:#bada55} a:hover{border-bottom-style:solid;text-decoration:none}

If it's decided that --output-style compressed should not change, perhaps a --line-breaks flag or a fifth --output-style could be added.


It's quite possible that this is a Sass issue rather than a Compass one. If so I'm happy to close it here and raise it in the appropriate place.

Reply to this email directly or view it on GitHub: https://github.com/chriseppstein/compass/issues/577

davidchambers commented 12 years ago

Thanks, @ttilley. That's perfect.

I feel silly for not learning exactly how the four existing output options behave before proposing a fifth. :)