Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Sass vs Stylus vs LESS
.border-radius (@radius) {
-webkit-border-radius: @radius;
-o-border-radius: @radius;
-moz-border-radius: @radius;
-ms-border-radius: @radius;
border-radius: @radius;
.user-list {
// need to use special `.` syntax
@mixin border-radius($radius)
-webkit-border-radius: $radius
-o-border-radius: $radius
-moz-border-radius: $radius
-ms-border-radius: $radius
border-radius: $radius
// need to use special `@` syntax
@include border-radius(10px)
// This and all CSS3 funcs are included in `nib` stylus plugin.
-webkit-border-radius: arguments
-o-border-radius: arguments
-moz-border-radius: arguments
-ms-border-radius: arguments
border-radius: arguments
border-radius: 10px
// or
.user-list {
border-radius: 10px;

paulmillr commented Mar 9, 2012

Why stylus:

  • Customizable syntax. You can write plain CSS or you may drop braces / semicolons or even :s etc.
  • Transparent mixins. If you don't need a lot of features, you can just stick to dropping vendor prefixes. But, of course, advanced features are supported too.
  • nib. Contains all CSS3 mixins. It's like a compass for sass but way better because of transparent mixins. No need to remember awkward namespaces (like @import "compass/css3/text-shadow").

ostera commented May 8, 2012

This is just awesome. Thanks a lot Paul for this comparison it just enlightened me. Will totally use Stylus from now on!

Your comparison is lacking, @paulmillr. Compass version (Sass syntax, which allows you to drop semicolons and braces too):

@import "compass"
    @import border-radius(10px)

Compass is like a CSS cookbook: It contains solutions to a lot of known and reoccuring CSS problems and patterns, not just CSS3 mixins. It's the most complete and well-documented collection out there, and this is why you should use it. From something as easy as @include border-top-right-radius, for just rounding the top right corner, or @include horizontal-list for creating a horizontal UL menu, to complex spriting creation:

Compass has a great community too. Want plug'n play CSS animations? No problem: Responsive (fluid) grids?

And yes: No need to remember awkward namespaces either, because you just @import "compass", and that's it.


paulmillr commented May 31, 2012

@torkiljohnsen as you may see, i've used .sass in the example.

This two extensions allowance is bullshit. Stylus can into both .sass and .scss syntaxes without problems.

Stylus has cookbooks too, we're using them.

Still, I need to remember which properties I need to include mixins for. E.g. @include border-radius(10px) or border-radius: 10px?

Compass is the cookbook, and it's accessible at @import "compass". nib's small collection of mixins also requires installation and invocation, just like Compass, with for instance .use(nib()) or @import "nib/gradients" for instance. Compared to Compass though, nib is tiny.

nib also tries to improve the clunky CSS syntax with it's own mixins and properties arrangements. For instance in nib you can do fixed: bottom right;, for a fixed, bottom right positioning, without mentioning position: anywhere. In Sass syntax you'd spot the @import immediately. Explicit is better than implicit in such cases IMO.

I just think your comparison is lacking. Your three selling arguements was the shorter syntax, the transparent mixins in nib which is supposedly like a compass for sass, and the lack of awkward namespacing. I find that Sass has a very similar syntax, that transparent mixins may be short and sweet but perhaps too implicit, and that nib does just a fraction of Compass does, and has just as awkward a namespace.

I think Stylus brings too little, and is too late to the party. It's sexy by all means, but not too big a difference from LESS or Sass/Compass. LESS wins the popularity contest by being easier to get up and running for non-coders, where Sass/Compass and Stylus requires command-line installation. Compass brings the biggest one-liner install of a cookbook though, which is an amazing timesaver, and why I land on that side of the fence. I wish you luck with your Stylus endeavors though! Any preprocessor is better than not using a preprocessor at all ;)

@torkiljohnsen I guess you actually meant:

@import "compass"
  compile: function(str, path){
    return stylus(str).set('filename', path).set('compress', true).use(nib());

^^ seems legit.

Stylus is maintained activelly ;).

lydell commented Dec 8, 2013

The vendor prefix thing isn't really valid anymore, because of autoprefixer.

aral commented Dec 28, 2013

Where did you read that stylus is no longer actively maintained as of October, 2013?

atomless commented Jan 4, 2014

@paulmillr last commit in the stylus repo seems to have been sometime in December :

Where has it been announced that stylus is no longer actively maintained?


paulmillr commented Jan 8, 2014

Sorry folks  — i've meant Sass but it is probably maintained too

artisin commented Dec 17, 2015

A bit late to this conversation I would like to add my two cents. @paulmillr it correct, stylus is a superior preprocessor by all means and measures and anyone who tells you otherwise is wrong.

@artisin - you forgot to add reasons for your statement. We do want to believe, but we need reasons.

linkdesu commented Oct 20, 2016

Stylus support something like $config['form'][$status][...] , I thought it is useful when you want to manage the style configure .

wrobclark commented Nov 12, 2016

I like the look and feel of stylus idk why. I'm on the fence between sass and stylus atm though not sure which one is gonig to with the race in my mind! @paulmillr

arjunepr commented Mar 6, 2017

Extremely late here, but I must raise an issue that seriously bugs novices (like me).

On one hand you have Stylus, with its minimal required syntax, flexibility, and incredible features (like functions, for instance). The pythonic syntax is incredible, allowing me to truly enjoy writing CSS. I'm sure many others feel the same.

However, when you look at the number of materials available for the preprocessor.. well, it's almost null. The documentation is excellent as far as documentations go, and I've also found an excellent tutorial for stylus by LevelUp Tuts on youtube. Besides that, all I could find are some articles. There's good frameworks like Kuoto Swiss but there doesn't seem to be much material on the same.

On the other hand, there's certainly an ample amount of material for one wishing to learning sass (more specifically the SCSS syntax..), Compass, and even Susy. It's worth mentioning that Bootstrap and Foundation both provide Sass support. There's also so many more frameworks and mixin libraries available for Sass..

Books on Responsive Web Design tend to glorify SASS but don't seem to mention Stylus at all, for the most part.

For those starting out who like stylus, it's a bit of a bummer imo.

arshadUIDeveloper commented Mar 17, 2017

I was about to decide on Stylus becasue the mixins are simple to write and since i already know Sass. But now after JunTheProgrammer comment i am worried to use stylus or go with Sass only

abienz commented Mar 28, 2017

@juntheprogrammer, it's only CSS ultimately, though. Do we really need endless repeated articles on how to write a mixin? The Stylus documentation has everything you need.

It's worth noting that Stylus is no longer in development at the time of writing. The last commit was on July 18th, 2016 ( SASS/SCSS is still under active development with the last commit made 5 days ago at the time of writing ( At this point in time SASS/SCSS has feature parity with Sylus if not more. In this situation I am more willing to develop using a technology still being updated over a project which has not seen an update in almost a year. I don't buy the excuse that Stylus is no longer being updated because it is feature complete either.

@Shirasho - Stylus seems to already be perfect - so, whether you buy it or not - you'll just have to try writing a project in Stylus - and then the same project in SCSS - and you will never use SCSS again. Unless you really like writing @import hundreds of times...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment