Skip to content
tdkehoe edited this page May 27, 2015 · 12 revisions

#Install and Initialize Sass

##Install Sass App

To install the Sass app:

npm install node-sass -g

-g is the global install. Leave it off to install in a single directory.

You only need to do a global install once.

##Create a New Project With Sass

Make a new directory, change into the new directory, then initialize Sass:

node-sass style.scss style.css -w

This creates a file style.scss in your directory. style.css is not yet created. To create style.css, open style.scss type anything, and save. style.css should then be created.

Write your CSS in style.scss. Don't make any changes in style.css.

##Install Sass in an Existing Project

Branch your existing project:

git branch _new-branch_

Move to the new branch:

git checkout _new-branch_

Rename style.css to style.css.

mv style.css style.scss

Now initialize Sass:

node-sass style.scss style.css -w

Open style.scss, write something, and save. Your old style.css file should now be style.scss, where you will write your CSS. A new file style.css will be created. Don't make any changes in style.css.

#Using Sass See http://sass-lang.com/guide.

Your @import lines should be after your variables, if the partials reference the variables.

Mixins and imports are the same thing (partials), except that imports are a separate file and mixins are in the same file. Also you can pass a variable into a mixin but not to an import.

In JavaScript a mixin is similar to a function but not the same.

Clone this wiki locally