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
8 answers

Setting background image with Jekyll-Assets

I've searched documentation, stack overflow, Google and attempted every CSS variation I could think of and can't determine a way of setting an image as a background to a div or element tag such as body using CSS. Should be simple, right? Attempts…
James Targett
  • 93
  • 1
  • 6
7
votes
2 answers

How do i create/convert a css file using sass scss

I am trying to create a file in sass and link it notepad ++ i have tried looking at videos on how to install it and use sass but they all are on mac.
user2970828
  • 81
  • 1
  • 1
  • 2
7
votes
1 answer

Use ampersand in selector name with SASS

Here's what i have in my CSS file ... .search-doctors-box { position: relative; z-index: 999; margin: 0px; } .search-doctors-box--at-map { position: absolute; margin-bottom: 10px; top: 0px; left: 415px; width:…
Kitze
  • 709
  • 3
  • 8
  • 21
7
votes
1 answer

How to dynamically generate CSS3 keyframe steps using SASS?

Let's say I have a key frame animation that has 100 steps that increases top by 1 px in each step. It would be logical to use a program to generate such a css. @keyframes animation { 0% {top:0px;} 1% {top:1px;} 2% {top:2px;} …
Mark Ni
  • 2,383
  • 1
  • 27
  • 33
7
votes
3 answers

env: ruby_executable_hooks: No such file or directory

When trying to build SASS, I'm getting the following error on Sublime Text 2. I've added the SASS build plugin from here https://github.com/jaumefontal/SASS-Build-SublimeText2 env: ruby_executable_hooks: No such file or directory [Finished in 0.0s…
Michael
  • 589
  • 2
  • 11
  • 26
7
votes
1 answer

How to configure directory-recursive Sass compilation task by Grunt

I'm a newbie and learning how to configure coffee, jade, and sass compilation tasks. I could successfully configure compilation tasks for coffee and jade directory but I couldn't for sass. The structure of my project is bellow . …
Mekajiki
  • 911
  • 2
  • 8
  • 18
7
votes
1 answer

BEM Confusions with naming elements

I have been using BEM on a project at work for keeping my CSS more modular and come across a few situations I feel a need for a bit of clarification on: Context dependent styles. I keep coming across a need to change a style of a module/component…
rctneil
  • 7,016
  • 10
  • 40
  • 83
7
votes
1 answer

SCSS - override an @extend with another @extend

A common problem I have with @extend is when trying to override the inherited properties with another @extend. Here's an example: // class selectors to be @extended // these could also use % to be silent/placeholder selectors .size-2xl { …
Dan
  • 423
  • 4
  • 9
7
votes
2 answers

Does anyone know how to install SASS on Laravel 4?

I am trying to run an install of SASS on Laravel 4. I am running composer and have my composer.json set up like this: { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], …
M dunbavan
  • 1,157
  • 5
  • 22
  • 57
7
votes
3 answers

Compass config.rb Location

I want to add Compass to my existing project. I want to maintain my current project structure, which looks like this (simplified): app/ build/ |-compass/ assets/ |-css/ |-scss |-js/ |-img/ So I want all my SASS files under…
elanh
  • 1,401
  • 3
  • 19
  • 31
7
votes
3 answers

possible to define an array in Sass?

wondering if it is possible to use an array with Sass as I find my self repeating the following sort of thing: .donkey h2 background-color= !donkey .giraffe h2 background-color= !giraffe .iguana h2 background-color= !iguana
Dr. Frankenstein
  • 4,634
  • 7
  • 33
  • 48
7
votes
1 answer

Sass extend and parent selector

I have the following Sass placeholder and I want to extend it. %btn // ...button styling... &[disabled], &.btn--disabled color: red .btn-primary @extend %btn The CSS output is the following: [disabled].btn-primary,…
TimPetricola
  • 1,491
  • 2
  • 12
  • 24
7
votes
1 answer

How to use SASS to parse a list of all CSS selectors in an .scss file?

I'd like to programmatically parse an .scss file to generate a flat list of selectors that are used in that file, mostly as basis for some static code analysis. In SASS terms, I'm looking for a way to get a list of all Sass::Tree::RuleNode for a…
timme
  • 140
  • 8
7
votes
3 answers

Sass has Compass and LESS does not ... LESS language isn't robust enough?

Recently i read the http://css-tricks.com/sass-vs-less/ post and one paragraph call my attention, related to CSS3 Helping So what this comes down to is: Sass has Compass and LESS does not. But it goes deeper than that. The attempts at creating a…
Javier Cadiz
  • 12,326
  • 11
  • 55
  • 76
7
votes
3 answers

Bourbon neat multiple breakpoints

I know following can be done in bourbon neat: $mobile: new-breakpoint(max-width: 320px); $tablet: new-breakpoint(max-width:760px min-width:321px); $desktop: new-breakpoint(min-width: 761px); then I can do something like this: @include…
emphaticsunshine
  • 3,725
  • 5
  • 32
  • 42
1 2 3
99
100