Using Sass with WordPress

I’ve never used Sass, so this will be an interesting task. I’ve used LESS a little, so I think I get the basic idea and I know the benefits of using a CSS generator. I was fiddling with a theme recently and it seemed to be crying out for Sass or LESS so I’m going to give it a go.

As usual I’m going to look for tutorials that will walk me through this. I’ve found a few promising entries so far:

  • Using Sass and Compass for managing CSS in WordPress
  • I think that first one will get me well on my way, but I also have never used Compass. Hopefully the Compass site will help me figure things out.
  • Finally, I’ve seen Forge mentioned a couple times (including the comments of the tutorial linked to above). The Forge home page describes it as a “command-line toolkit for bootstrapping and developing WordPress themes in a tidy environment using front-end languages like Sass, LESS, and CoffeeScript.” I’ll check it out.

< … gets one minute into tutorial … >

This is not starting well. I’ve tried to install Ruby 1.9.3-p0 per the instructions, but I’m getting the following error message:

The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.

I’ve come across this error before but I can’t remember if I solved it or just worked around it. I’m also not sure if really need 1.9.3 or if I can just use 1.9.2-p320, my currently installed ruby version.

On a whim (it should have been the first thing I did) I ran rvm list and it turns out I have 1.9.3-p194 already installed. How’s about if I just use that.

Hmm … What’s the command for switching versions in rvm? rvm use 1.9.3 is the command I needed.

Next issue: I installed compass but when I go to run compass create test I get “compass: command not found”.

< … research resarch research … >

Turns out I needed to run sudo gem install compass. With that cleared up, I followed the rest of the tutorial and I’m all good.

One note about the tutorial: It seems that if you provide an incorrect path to the config.rb file for compass, it will not only not give you an error message, it will create the non-existent directory and any other non-existent directories that comprise the path. I found this out the mildly hard way.

Leave a Reply