A few days ago, I mentioned that not everyone liked the Sass' CSS output 
style. I said we were thinking about giving the users an option to 
choose between several different output styles. Well, guess what? It's 
implemented! You can now choose between three styles of output by 
setting options in environment.rb. There would be more options, but I 
only know of three distinct CSS styles... if anyone has more they'd like 
to see, let me know (or better yet, submit a patch!).

The three styles are "compact", "expanded", and "nested".

Compact is the style you're used to seeing Sass output, although it's no 
longer the default. Each CSS rule takes up only one line, with every 
attribute defined on that line. Nested rules are placed next to each 
other with no newline, while groups of rules have newlines between them. 
For instance,

#main { color: #fff; background-color: #000; }
#main p { width: 10em; }

.huge { font-size: 10em; font-weight: bold; text-decoration: underline; }

Expanded is the typical human-made CSS style, with each attribute and 
rule taking up one line. Attributes are indented within the rules. Like 
compact, nested groups of rules aren't separated by newlines, which 
other groups are. For example:

#main {
  color: #fff;
  background-color: #000;
}
#main p {
  width: 10em;
}

.huge {
  font-size: 10em;
  font-weight: bold;
  text-decoration: underline;
}

The final style, nested, is one you probably haven't seen before, but 
one that's very cool. It emphasizes the nesting of rules in much the 
same way Sass does, which is why it's the new default. Like expanded, 
each attribute has its own line, but the indentation isn't constant. 
Each rule is indented based on how deeply it's nested. For example:

#main {
  color: #fff;
  background-color: #000; }
  #main p {
    width: 10em; }

.huge {
  font-size: 10em;
  font-weight: bold;
  text-decoration: underline; }

Nested style is very useful when looking at large CSS files for the same 
reason Sass is useful for making them: it allows you to very easily 
grasp the structure of the file without actually reading anything.

As wonderful as nested style, the new default, is, I'm sure some of you 
want to play around with the other styles (and there may even be a few 
who are more comfortable with expanded or compact style in the long 
run). The question, then, is how do you set the style? The answer is by 
adding one line to environment.rb:

Sass::Plugin.options[:style] = :expanded

You would, of course, replace ":expanded" with ":compact" if you wanted 
to use that.

Got any suggestions for new styles? Please let us know! As usual, these 
features are only available in trunk. Enjoy!

- Nathan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to