the future of SASS syntax

1 view
Skip to first unread message

Eric Meyer

unread,
Nov 19, 2009, 4:45:21 PM11/19/09
to Compass
Chris,

I noticed that you are moving all of Compass over to the CSS-style
syntax with the colon after each property rather than before. I can
see some obvious reasons for this, although I've become a fan of the
SASS syntax, but I'd love to hear your thought process. Is this
something you would recommend we all do? It does seem to me that
plugins ought to use the same syntax as what they plug into, so I
suppose I'll start making the switch for Susy.

Thoughts?

Tim Harding

unread,
Nov 19, 2009, 4:53:53 PM11/19/09
to compas...@googlegroups.com
FWIW, I too have really enjoyed the

:property value

syntax rather than

property: value

It feels more congruent with the rest of SASS.

And lines stuff up nicely in my text editor.

Having said that I'd rather just have a blessed style to follow and then I can happily forget about syntax and get on with important things.

-Tim


--

You received this message because you are subscribed to the Google Groups "Compass" group.
To post to this group, send email to compas...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/compass-users?hl=.





--
Tim Harding

Well Informed Ltd
Registered in England & Wales
Company number 06707839
Registered office: Suite 235, 77 Beak St, London, W1F 9DB


Alex Cabrera

unread,
Nov 19, 2009, 4:58:05 PM11/19/09
to compas...@googlegroups.com
Oh no! Everything's going property:? I really liked having it be :property, that way you could easily tell if something was a mixin, a regular property, or a
pseudo-class from the first character.

Actually, come to think of it classes and IDs are defined by the first character; why make properties the only ones different?

Alex Cabrera
Interactive Director, Policus

- Sent from my iPhone. Please excuse any typos, missing words, or any otherwise gross and barbaric perversions of the English language.

Andrew Vit

unread,
Nov 19, 2009, 5:43:38 PM11/19/09
to compas...@googlegroups.com
Hi Eric,

I think the original idea was to make the sass properties resemble ruby :symbols, which are often used as keys for a hash. (And a CSS property list is a hash of sorts.)

It’s not really the right syntax though, since there’s no separator between the key and the value like in :ruby => hash_syntax. It’s not like JSON or CSS either, so why reinvent the wheel and make CSS authors (regular designers to whom Sass is alien) learn an arbitrary new syntax?

I know we all got used to it, but I think changing it to be congruent with CSS is a good idea.

Regarding the use of the first character as a “type” identifier, let’s see, we have selectors like:

h2, #header, .hotpink, :first-child

These include both no-prefix for an element name (h2) and the colon-prefix (:first-child), so I don’t think there’s a solid argument for consistency here.

I think the colon after the property is a better idea and it will make it more obvious what’s a property, because nothing else in CSS looks like that.

There’s one or two other points I would add to this syntax debate, which is that mixing colons and equals= (for interpolated values) adds some mild confusion too. If it doesn’t slow things down too much, I’d be happier to see colons used throughout.

String quoting (where to use or not use double "quotes" and how they’re different from single 'quotes' in ruby is confusing too. Off the top of my head, single quotes get output into the CSS source and double quotes don’t, IIRC.

Andrew Vit

(Is the Sass group an ex-group, bereft of life, or just pining for the fjords? Is this discussion more appropriate in the Haml group?)

Chris Eppstein

unread,
Nov 19, 2009, 5:52:01 PM11/19/09
to compas...@googlegroups.com
Sass will continue to support the colon-first notation for the foreseeable future. It is NOT deprecated. However, the compass code-base is and should be a place for people to explore sass and deepen their understanding of what you can do with Sass. New (non-ruby) users often find the colon-first syntax to be off-putting and to be a capricious change from CSS. As such, Nathan and I decided that all sass & compass documentation and code will use the css-like colon syntax going forward.

Whether you convert your Sass files to use the colon-after syntax is, of course, up to you, but would encourage compass & sass libraries to do so for the same reasons.

Chris

Eric Meyer

unread,
Nov 19, 2009, 5:55:43 PM11/19/09
to Compass
Thanks Andrew,

I didn't realize that this was a SASS-wide change, which is why I
asked it here. I only saw that Compass was making the jump. I
completely agree with all your reasoning. Is there movement on the ":"
v. "=" front or the quoting of strings? I would also love to see those
simplified.

I don't use HAML (unless SASS counts), so I haven't been on that
discussion. I'm happy to head over there if you'd prefer.

In terms of how this affects us in the compass plugin world, do we all
need to be moving our plugins to the CSS syntax? Is it already
available in the latest release of SASS? Will the old syntax still be
available in the next? What's the time-line on this?

Thanks!

Eric Meyer

unread,
Nov 19, 2009, 5:57:22 PM11/19/09
to Compass
Thanks Chris! I'll start working on the move.

Eric

Nathan Weizenbaum

unread,
Nov 19, 2009, 6:02:46 PM11/19/09
to compas...@googlegroups.com
The Sass group is indeed dead. The Haml group is the appropriate place for discussions of non-Compass-related Sass syntax issues.

Chris's summary of why colon-first syntax is no longer preferred is accurate. As for colon vs. equals, that's a confusion we're aware of. There are some irresolvable syntactic ambiguities between full-on SassScript and colon properties, but we're planning to make it easier in future versions of Sass to use variables and operators in colon properties without needing #{}. This will likely become the recommended way of using dynamic values in properties.

The current situation with string quotes is that SassScript simply doesn't support single-quoted strings in any way. If people want, I could add support for them. They would probably behave identically to double-quoted strings.

Chris Eppstein

unread,
Nov 19, 2009, 6:04:16 PM11/19/09
to compas...@googlegroups.com
+1 for single-quoted strings.

Alex Cabrera

unread,
Nov 19, 2009, 6:56:42 PM11/19/09
to compas...@googlegroups.com
Agreed, single quote strings I think remove confusion. I always think
of double quoted strings as strings where there is some sort of
variable to be interpreted within it.

Alex Cabrera
Interactive Director, Policus
http://policus.com



Nathan Weizenbaum

unread,
Nov 20, 2009, 6:41:17 AM11/20/09
to compas...@googlegroups.com
I've just pushed a change to master to add the single quote behavior described above to SassScript.
Reply all
Reply to author
Forward
0 new messages