Hacker News new | ask | show | jobs
by mrchess 5259 days ago
Does anyone know why LESS was picked over SASS for Bootstrap?
2 comments

While Less and Sass are really similar products that do pretty much the same thing; I switched my site from initially using Sass (scss) to now using Less for three reasons:

a) Bootstrap uses less and I'm using bootstrap.

b) It was trivial to go from sass to less. Mostly just renaming files to have the right suffix.

c) I'm sure someone can argue differently, but I really think that the mixin syntax for Less is significantly better than Sass. I don't use mixins all the time, but this is really important if you want re-usable code. With Less, you don't have to declare @mixin and then @include it. Instead, any less block becomes a potential mixin.

That said, Sass has a compressor/minimizer and Less doesn't really have one. I had to integrate clean-css into my builds. It would be nice if Less had this by default.

relevant documentation links on your point “c)”:

http://lesscss.org/#-mixins

http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#im...

Sass, too, supports Less’s mixin model. Sass can include any block as a mixin with the @extend directive (http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#ex...). Basically, if a block is going to be used in the HTML as well as elsewhere, you write it normally and then include it with @extend. If a block is only going to be included in other styles, you write it with @mixin and then include it with @include. I think Sass’s approach is better because it’s more flexible – if a style isn’t going to be referenced in the HTML, it doesn’t clutter up the CSS because it is hidden with @mixin. And if you like Less’s approach better you can just use @extend everywhere.

The main reason I prefer Sass is the indent-based and semicolon-less Sass syntax (as opposed to the SCSS syntax). I find that that syntax’s advantages greatly outweigh its few weaknesses.

http://markdotto.com/bs2/docs/less.html

Odd, it says that lessc can take --compress, but using the most recent version of less in npm says that there's no such flag.

Maybe it's on the way, or the bootstrap authors know something we don't.

Ah, that got me looking more closely. There is an option to use yui-compress and it seems with the 1.2.1 version. I use the shortened -x argument.

https://github.com/cloudhead/less.js/pull/504/files

I don't know why, but if you are looking for SASS there is a fork:

https://github.com/jlong/sass-twitter-bootstrap

I've been using https://github.com/thomas-mcdonald/bootstrap-sass/tree/2.0 for the last few days. I haven't encountered any problems.

A big thanks to Thomas if you read this, a gem is way nicer than converting it myself.

Much appreciated - it's nice to hear and see others using it. There's a few commits to catch up with on the 2.0-wip branch, hopefully I'll get some updates done and pushed today.