Questions tagged [sass]

Sass (Syntactically Awesome Style Sheets) is an extension of CSS adding features like nested rules, variables, mixins and class extensions. This enables developers to write structured, manageable and reusable CSS. Sass is compiled into standard CSS. It is primarily a CSS pre-processor language that accepts both the CSS and its personalised syntax of writing visual design codes.

Overview:

Sass is a meta-language on top of that describes the style of a document cleanly and structurally, with more power than flat CSS allows.

Sass is an extension of written in . It adds nested rules, variables, mixins, selector inheritance, and useful functions like color manipulation or conditional statements2. It's translated to well-formatted, standard CSS using the command-line tool or a web-framework plugin.

It is the only language that can store design tokens (e.g. colors, font sizes, spacing) and use the value types9 natively; i.e. numbers, colors, strings, lists, and booleans.

Sass has two syntaxes:

  1. SCSS (Sassy CSS): As of Sass3, this is the main syntax. It is a superset of CSS3, so all valid CSS files are also valid SCSS. Files with this syntax have the extension .scss.

Example SCSS:

$margin: 12px;

li {
  .border {
    margin: $margin / 2;
  }
}
  1. SASS: The indented syntax. Instead of braces and semicolons, it uses line indentation to specify blocks (similar to Ruby's syntax). Files with this syntax have the extension .sass.

Example SASS:

$margin: 12px

li
  .border
    margin: $margin / 2

Frameworks / Extensions:

  • 4 is an extension of Sass which provides pre-defined cross-browser mixins and additional functionality like automated sprite-generation.
  • 5 is a simple and lightweight mixin library for Sass.

Flavors:

  • Ruby Sass1 is the original Ruby-based version of Sass.
  • LibSass6 is C/C++ port of the Sass precompiler. It compiles very quickly, can be embedded in other languages and binaries, and aims for feature parity with the original Ruby Sass.
  • Node Sass7 uses LibSass to compile .scss files using Node.

Links:


Resources:

27250 questions
7
votes
3 answers

How to use SASS in Ionic framework?

I am trying to use SASS in my project. I open this link and follow all command. I create a project and setup SASS. http://learn.ionicframework.com/formulas/working-with-sass/ I got this directory structure scss | |—>ionic.app.scss …
Pallavi Sharma
  • 635
  • 2
  • 16
  • 45
7
votes
6 answers

Gulp Sass not compiling partials

So I am using Gulp Sass with gulp-changed (i've also tried gulp-newer with the updated syntax changes) and watching all the scss files in my folders. When I change a base scss file it will compile without any problems. However if I change a partial…
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291
7
votes
1 answer

Not last child mixin SASS

Is it possible to turn this: .redstripe p:not(last-child) { border-bottom:1px solid red; } Into a mixin so that I can apply it to any element and assign a child tag to it like: @mixin redstripe (this.$children):not(last-child) { …
HGB
  • 2,157
  • 8
  • 43
  • 74
7
votes
1 answer

Why node-sass-middleware is not working?

I have installed the node-sass-middleware module on my express application, but i'm not getting that working, just because the middleware is reading an incorrect source, when i debug the console log is: GET / 200 558.983 ms - 4651 source:…
user3697569
7
votes
3 answers

In HAML on Ruby on Rails, how to use the :sass filter?

If using HAML on Ruby on Rails, then :sass #someDiv border: 3px dashed orange won't have any