Hello everybody.  I've been working on a Java implementation of the
Sass compiler for the last few weeks (using ANTLR).  For the most part
development has gone swimmingly, but I've run into a few issues with
the Ruby Sass compiler and wanted to ascertain from the community
whether these issues fall in the category of "needs to be fixed,"
"functioning as designed," or "meh . . . we may get to it sometime."

Before I go on to my laundry list, I should mention that I have very
much enjoyed using the Sass language and am thankful to all the
contributors.  I'm currently working as a front end developer for a
large corporation, and using Sass has greatly improved the quality of
our (formerly highly repetitive and fragile) CSS code bases.

Also, the noted Java compiler will be released under an open source
license.  I'll probably post a few more announcements/questions to the
list about that in the near future...

Onto the questions and observations about the Sass compiler.  A lot of
the issues have to do with attribute selectors, which aren't in much
use now due to IE6, but I imagine will see increasing use as that
browser's market share decreases.  My reference implementation for
this exercise was the version of Sass that Hampton uploaded to Github
a while back.

### 1 ###
Sass mis-lexes this css selector as a declaration (and throws an
error)

p[title="Colon: followedByWhiteSpace"]
  :color red

### 2 ###
Color shortcuts in string literals can be a bit of a surprise

p
  :foobar = i have a red bicycle
---
p { foobar: i have a #ff0000 bicyble }

### 3 ###
Improperly splits attribute selectors with commas

.foo
  div[title="some,value"]
    :color #f00
---
.foo div[title="some, .foo value"] { color: #f00; }

### 4 ###
Improperly substitutes parent selector
.baaz
  .foo[title="&"]
    :color #f00
---
ought to produce
.baaz .foo[title="&"] { color: #f00 }
---
but actually produces
.foo[title=".baaz"] { color: #f00 }

### 5 ###

Comma separated selectors have bizarre indentation rules when wrapped
across multiple lines.
For all the follow examples I'd expect the output CSS to be
p div, p .foobar {
  color: #f00;
}
--- ok if continued line starts at 0 column
p
  div,
.foobar
  :color #f00

--- silently deletes nested selector if indented same amount as
beginning of selector
p
  div,
  .foo
  :color #f00
--- output
p {
  color: #f00; }

--- throws syntax error if indented 2 spaces past beginning of
selector
p
  div,
    .foo
  :color #f00
--- output
(sass):3: Rules can't end in commas. (Sass::SyntaxError)

### 6 ###
This isn't such a big deal but the docs and source code could be a bit
more precise with their use of CSS terminology.  Specifically, what is
extensively referred to as an 'attribute' is actually called a
'declaration' in CSS. 'Attributes' in the context of CSS most often
refers to a certain category of selectors (e.g. div[title="foo"]).
Similarly, what is referred to as "attribute namespaces" should be
called "property namespaces."  Lastly, what is referred to as "rule
escaping" in the Sass documentation ought to be called "selector
escaping."

### 7 ###
Developers can get away with pretty bizarre constant identifiers and
length/unit suffixes.  This also isn't such a big deal, but lexing
could be a bit more efficient/simpler if things were locked down some
more.  (Perhaps adopt Ruby's rules for identifiers?)  As an example,
this is a legal statement in Sass:
!...@~.......foo = 2
It creates a constant with name "!...@~.......foo" and assigns the
value 2 to it.

### 8 ###
There are many more built-in color shortcuts in CSS (as implemented in
the major browsers) than those mapped in Sass.  Sass does get all the
W3C specified ones though.  See http://www.w3schools.com/css/css_colornames.asp
Papaya Whip!

### 9 ###
The adjacency operator (concatenation) requires a space between
arguments, unlike Ruby which doesn't always require a space.  If
you're going for the Ruby idiom, you probably shouldn't require a
space.

Aaaaand that's it.  Any feedback would be greatly appreciated.

Thanks,
-Joey Hurst

--~--~---------~--~----~------------~-------~--~----~
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