Just. Learn. Sass.

CSS sucks.

I believe Douglas Crockford tells it best as describing CSS as a "Long, fragile lists of self-contradictory rules."

However, there's a way to make this aweful experience a bit better. This is through Sass. This is a CSS like syntax with an extended functionality , focus on DRYness and a lot more clarity. You write SASS, then you transpile into CSS.

A lot of people don't like to go through the extra effort of learning a new language. Well, if you were facing the same fear... don't worry. It takes less than 5 minutes to learn Sass.

Reason 1: It is fast to learn

It takes 5 minutes to learn Sass. Don't believe me? Take out your phone, take a large cup of coffee, put up a 5 minute timer, and go to this page: http://sass-lang.com/guide. I bet you can understand most of it really fast.

Reason 2: It is really easy to transpile

Transpiling your Sass into your CSS can be easily included into a task that can be handled by either Grunt or Gulp.

Reason 3: Mixins, mixins, mixins

Don't you hate writting this?

.box {
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  -ms-border-radius: 10px;
  border-radius: 10px;
}

Sass allows you to create mixins that allow you to keep your StyleSheets really DRY.

@mixin border-radius($radius) {
  -webkit-border-radius: $radius;
     -moz-border-radius: $radius;
      -ms-border-radius: $radius;
          border-radius: $radius;
}

.box { @include border-radius(10px); }

Reason 4: It's not a new thing

This is just not the next hipster programming trend to follow. Sass is mature. It's supported by thousands of developers and plenty of companies. Take a look at the source code and see for yourself.

Reason 5: Extend

Have you ever dealt with messy and repeated CSS selector definitions?

.message, .success, .error, .warning {
  border: 1px solid #cccccc;
  padding: 10px;
  color: #333;
}

.success {
  border-color: green;
}

.error {
  border-color: red;
}

.warning {
  border-color: yellow;
}

What if I told you, that you only need a single selector definition when using Sass?

.message {
  border: 1px solid #ccc;
  padding: 10px;
  color: #333;
}

.success {
  @extend .message;
  border-color: green;
}

.error {
  @extend .message;
  border-color: red;
}

.warning {
  @extend .message;
  border-color: yellow;
}

@extend allows you to just grab properties from other style definitions and include them into your selector.

Reason n: Find out yourself

If you've gone down this far, you would definetly like to learn more about it.

Learn More:

comments powered by Disqus