Interpolation: Roole vs Sass

This was more or less a mential exersize in seeing what the differences are between Sass and Roole when it comes to interpolation. A conversation sparked from the Twitters.

As a result, I didn't come to the conclusion that Roole's supoprt of interpolation isn't any 'better' then Sass. In most cases, it is a simple syntatical difference. Sass simply adheres to Ruby's interpolation syntax.

But this review presented me with the opportuntiy to dig deeper into a few other features like scoping and extends.

Scoping

Another point brought up in this Tweet was Roole's support of scoping variables within selector rules. This is interesting to me. Not sure yet how I feel about it. On one hand this is handy to have, on the other this can lead to somewhat chaotic code. Sass leans heavily on the cascade, simply I assume because this is how CSS works.

Sass somewhat supports this feature in the context of mixins. To me that makes a little more sense.

Extends

Roole's @extend feature isn't all that dissimilar from Sass, but I have to give a thumbs up to their exact selector matching feature.

.icon
  font-family: icon-font

.button .icon
  font-family: button-font

.button .edit-icon
  @extend .icon
  content: 'i'

Returns

.icon, .button .edit-icon {
  font-family: icon-font;
}

.button .icon {
  font-family: button-font;
}

.button .edit-icon {
  content: 'i';
}

Whereas the same code in Sass returns

.icon, .button .edit-icon {
  font-family: icon-font;
}

.button .icon, .button .edit-icon {  <-- the diff
  font-family: button-font;
}

.button .edit-icon {
  content: "i";
}

SassMeister Gist

Play with the code