Redesign of dlang.org

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 24 07:19:56 PDT 2014


On Thursday, 24 April 2014 at 07:59:20 UTC, Martin Nowak wrote:
> Nice, thanks a lot. How much effort would it be to turn this 
> into a full SCSS compiler?

Hmm, looking at the sass webpage, I think I could do some of the 
features but prolly not all and with a different syntax. So it 
wouldn't work for a full scss compiler.

If you want that, just use that C library or the ruby original.


My thingy is really just a generic text macro system with an 
extension that kinda understands css syntax and simply aims to be 
good enough for me. I can add to it but since it is good enough 
for me already, I don't have a pressing desire to go all the way. 
(As you might have heard on irc, I started a new job a couple 
weeks ago tho.... and it is a Ruby on Rails thing, so who knows, 
maybe I'll use the sass in that and find something I like enough 
to spend the time cloning it, but so far I use sass as just a 
substitute for my own cssexpand.)


Below is my impression of the sass docs.

Looks like the two big things they offer that I don't are 
inheritance and math.

Inheritance might be easy, I parse it out anyway so a referencing 
thingy could do that, sass calls that @extend. Math is something 
I avoided because it isn't terribly useful IMO and getting the 
units right isn't easy. What's 1em / 16px? Depends on the font 
size... which depends on the whole dynamic cascade.

Perhaps a unit mismatch could just issue an error though, 
sidestepping all that. So a little dimensional analysis!

We have some different syntax details though, like their variable 
assignment vs my set macro and the parent selector referencing in 
nested things is different.

Actually, the sass way of & might be a bit better than mine. For 
example, in mine:

a {
   :hover { color: red; }
}

expands into:

a {}
a:hover { color: red; }

If you wanted to reference a child with a pseudoclass, you'd have 
to do:

a {
   *:hover { color: red; }
}

then then gets you

a *:hover { ... }



Similarly, to add a class to the parent, mine does:

a {
   \&.foo {
   }
}

expands to a.foo {}


Something sass does that mine does NOT do is:

a {
   body & {}
}

which expands into body a {} and that's potentially useful. I 
think I'll add that.


* * *


I've done the import thing before but I don't think it was in 
css.d, I think I did that in the work app's proprietary file.

I do support @media rules but only on the outer level. sass also 
supports them inside a nested thing. That's kinda useful.

* * *

Looping and such? Yikes. I think I actually do support looping 
via one of the macros, but the syntax is pretty different.


More information about the Digitalmars-d mailing list