SASS, briefly

I'm running on a Mac, and using BBEdit as my text editor, so these instructions are aimed at a similar setup. Mostly I'm repeating what is on the SASS site.

Since the move over to Dart, installing SASS is extremely simple. Download it from Github, unzip the download, and put it literally anywhere. Then, add it to you shell PATH, and you are good to go.

As an example, I've put SASS, which is in a directory called dart-sass, in Documents, in a directory called Web. Adding to PATH is telling the shell where Sass is, and you add it in a file called .bash_profile. This file is normally hidden (note the name begins with a dot), but you can check to see if it exists by going to your home is the Finder, and using the keyboard command CMD-SHIFT-period. If it doesn't exist, just create it. In my case, I add the following: export PATH="/Users/mark/Documents/Web/dart-sass:$PATH" (without the quotes), save the file, and open a new Terminal window. In Terminal, type sass --version, hit return, and you should get the SASS version number (mine is currently at 1.17.0)


To run SASS, the easiest thing to do is to create a shell script. That way you don't need to type the command every time you use SASS. In your text editor, create a file called or something. Just use the .sh extension. The file will contain a single command, which starts SASS watching your scss file for changes, and when you save that, will write those changes to your css file. Start with the 'shebang' line, or #! /bin/sh. The command itself is sass --watch. This is followed by the path to your css file, then the path to your css file. The whole thing will look like this:

#! /bin/sh
sass --watch /Users/mark/Documents/Web/Assets/202/202.scss:/Library/WebServer/Documents/202/x/main.css

Note the paths are absolute, from the top level directory. The colon between the scss path and the css path is optional (it seems), you can just use a space. BBEdit has a 'run in Terminal' command, or you can copy and paste the command in Terminal, and Sass should be running.