SASS & COMPASS

& Drupal

Jason Bell

I build pieces of the web at Start Interaction.

I am various permutations of myself on…

I help organize Fox Valley Drupal.

Sass

  • Sass is a preprocessor for CSS that will help you fall in love with CSS all over again.
  • Sass is written in Ruby and distributed via RubyGems.
  • There are 2 syntaxes. Both work.
    • .sass = old
    • .scss = new, more common, just use it

Installing Sass

It's slightly different by platform, but essentially boils down to the following command:

gem install sass

Create a Sass project

Every valid CSS3 stylesheet is valid .scss. You can change the extension of an existing file to get rolling.

From your project directory run:

sass --watch style.scss:style.css

This will compile your .scss file into a .css file.

Variables

Use variables to store values you use all over the place.

CSS

$black: rgb(30, 30, 30);
$green: rgb(116, 187, 2);
$base-font-size:   16px;
$base-line-height: 20px;

body {
  color: $black;
  font-size: $base-font-size;
  line-height: $base-line-height;
  padding: $base-font-size*2;
}

h1 {
  color: $green;
}
            

Sass

body {
  color: #1e1e1e;
  font-size: 16px;
  line-height: 20px;
  padding: 32px;
}

h1 {
  color: #74bb02;
}
            

Sass & Compass with Drupal

Yes, there are Drupal modules with these names.

No. I have not used these. I'm not entirely sure why you would want to.

Sass and Compass are authoring tools, not server side components.

Resources

Use your favorite search engine to find thousands of articles to help you.

Read this presentation from Sam Richard for more depth on what we covered tonight.

Sass

Compass

http://jasonbell.github.io/dcfv-sass/