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

Rails: drawbacks of using Sass's @import instead of *=require

I decided to use Sass's @import instead of Sprocket's *=require. I have this in application.scss: @import 'normalize'; @import 'font-awesome'; @import 'variables'; and this in blog.scss: @import 'application'; This way I have separate stylesheets…
Stephan
  • 137
  • 1
  • 8
7
votes
2 answers

How can I change charset in SASS (SCSS)

When working on web projects I'm using css preprocessor SASS with SCSS syntax. In the comments, I like to write what the following code does, I write comments in my language (in czech). Unfortunately, when you compile it throws me the error coding.…
Mardzis
  • 760
  • 1
  • 8
  • 21
7
votes
5 answers

Sunburst effect with css3 gradient

I have been looking around and trying for a few days, but i just cant seem to get it 100% right... i am trying to achieve the following effect with css3 gradient: the closest i have gotten is DEMO: html { background: …
user1278673
7
votes
4 answers

How to have left and right spacing between table rows and table edge?

This is the desired effect: And this is what I came up with: http://jsfiddle.net/nunoarruda/3j6782js/ // table .sw-table { border-collapse: separate; thead { background-color: $orange; color: $white; font-size: 15px; th { …
nunoarruda
  • 2,679
  • 5
  • 26
  • 50
7
votes
1 answer

How do I import bootstrap-sass once and use it in several files?

In the docs you can read the following: Import Bootstrap into a Sass file (for example, application.css.scss) to get all of Bootstrap's styles, mixins and variables! @import "bootstrap"; https://github.com/twbs/bootstrap-sass I have several scss…
Joe
  • 4,274
  • 32
  • 95
  • 175
7
votes
3 answers

Shows Error - failed to extend when a class is extended in SASS

.class{ color:#333; } .ex-class{ @extend .class; } Shows error: ".ex-class" failed to extend ".class" The selector ".class" was not found. This will be an error in future releases of Sass Use "@extend .class !optional" if the extend…
asp
  • 743
  • 2
  • 9
  • 29
7
votes
2 answers

How can I fire PHPStorm's deployment from Gulp.js

I'm using Gulp.js to watch sass files in my project and auto-compile/minify them. I've got my PHPStorm set up to automatically deploy(upload) changed files, including external changes. The problem I'm having is that PHPStorm doesn't recognize the…
David Angel
  • 1,001
  • 2
  • 10
  • 21
7
votes
2 answers

Is it possible to convert whole folder with convert-sass? (scss to sass)

I have a bunch of files in bunch of folders in SCSS format. I need to convert it all to SASS format, and I know sass has a specific command for that convert-sass, however I am not sure whether it is possible to convert whole folder (with folders…
nerijusgood
  • 321
  • 1
  • 3
  • 17
7
votes
2 answers

Sass with BEM, inherit selector

I'm using Sass 3.4.1 and BEM so my scss is: .photo-of-the-day{ &--title{ font-size: 16px; } } and I want every time hover over .photo-of-the-day something happen with title, that's pretty common so usually in…
alexrqs
  • 183
  • 1
  • 6
7
votes
1 answer

How to off-set Columns in Susy Grid System?

I want to Off-Set Columns using Susy, like off-setting columns in Bootstrap. I tried to use @include span(4 at 4); But that doesn't work. What I'm doing wrong?
Ruby
  • 2,207
  • 12
  • 42
  • 71
7
votes
5 answers

How to make my background image appear only on one page in rails 4?

I have a background image that I can not get to stay just on one page. I have made a welcome controller with one home view to display it. I am precompiling my assets as well. The background shows up just fine, but my goal is to just show the…
dobsoft
  • 109
  • 1
  • 7
7
votes
2 answers

What does "Please set program to run!" means in PHPStorm?

I have the following message when trying to add a new file watcher. Still can't find the solution. Can someone help me?
Monica
  • 1,524
  • 4
  • 27
  • 44
7
votes
1 answer

How to use SASS with Polymer?

I'm trying to use SASS with Polymer but I don't know how to have multiple outputs. I'd like sass to compile each scss files in their own directory, I don't need a global css output... Is there a solution to this issue ? Thanks
Thibaut Maurice
  • 477
  • 1
  • 8
  • 17
7
votes
1 answer

File to import not found or unreadable: compass/css3 on compiling a ready made .SCSS file

I just recently downloaded a ready made project and it has scss files on it too. when I tried to compile main.scss file using koala-app it gives me this error. C:\Users\1\Desktop\agency\sass\main.scss Syntax error: File to import not found or…
melvnberd
  • 3,093
  • 6
  • 32
  • 69
7
votes
4 answers

SCSS @import in Jekyll 2.1

I've this project structure -Project -css -main.scss -_sass/ -base -layout -pages -vendor Content of my main.scss file. --- --- @import "sass/base/reset"; @import…