Submitted by andrew on
I know there are a bunch of these posts explaining how to configure Compass and Sass on Windows, but I wanted to post a cut-and-dry explanation for the rest of us specifically using Aptana Studio 3. I hope this helps someone out there looking to dive into Sass development.
What is Sass?
I'm not even going to answer that, becuase you wouldn't be here if you didn't know.
What do I need?
Aptana Studio, which is the best code editor available (in my opinion). It can be downloaded here:
http://www.aptana.com/products/studio3/download
The Windows Ruby installer. This is a one-click installer for the rest of us not "hip" enough to own a Mac or run Lynux.
http://rubyinstaller.org/downloads/
Be sure and not where you installed Ruby. The default is at the root of your C drive, and I'll use that for my example below.
What do I do?
Once the two items above are installed, you are ready to go.
STEP ONE:
Open Aptana and create a new project. Be sure to note where the project is on your drive, you'll need that path for step two. For this explanation, I made one here:
C:\Clientwork\APW\apw.misc
This is the webroot of my project, where the css, images, and js folders are.
STEP TWO:
Open a Windows Command Prompt and move to where you installed Ruby, landing in the "bin" directory:
cd "C:\Ruby193\bin"
Now you'll need to install the Compass component. This is what will compile your Sass files into CSS for you. It runs on Ruby, which is why you had to install it. Enter this at the command line to install:
gem install compass
At this point, you have Ruby and Compass installed and can set up your Sass project. Enter this line to configure one in the webroot of your Aptana project (change project path to yours):
compass create C:\Clientwork\APW\apw.misc --sass-dir=sass --css-dir=css
Ok, now you are ready to go! This command did a few things.
- Created a folder for your Sass files (/sass) and put some default files in there to get you started.
- Created a folder for your CSS files (/css) and did an initial compile of the Sass files for you (created CSS files from them).
- Created a Sass configuration file in your webroot (/config.rb) that has some settings in it to get you started.
You will want to update your HTML to include the stylesheets in your CSS folder.
<link href="/css/screen.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/print.css" media="print" rel="stylesheet" type="text/css" /> <!--[if IE]> <link href="/css/ie.css" media="screen" rel="stylesheet" type="text/css" /> <![endif]-->
STEP THREE:
Compass can "watch" your Sass directory for changes made, and compile new CSS files automatically for you. This is extremely helpful. To turn this feature on, enter this at your command prompt (obviously changing the path to where your project is):
compass watch C:\Clientwork\APW\apw.misc
STEP FOUR:
Go outside, grill some tips and have a pint!
Comments
FC replied on Permalink
Problem in STEP ONE: when create a new project, there is a wizard page for {PHP project, Rails Projets, Ruby Project, Web Project, General, PyDev, Ruby, Web(PHP Project, Web Project), Other} In your example, which wizard should we choose ?
Sorry about being so vague. You can create any sort of project. It will just put a codebase somewhere on your machine. It's that codebase you need to start the "compass watch"
Andrew
Rose replied on Permalink
Thank you - up and running in 10 minutes. I like Aptana too, stopped using Dreamweaver a year ago and have never missed it! Now to learn Sass over the weekend.
Much Thanks!
Jeany replied on Permalink
Hello Andres thanks for this post. I already have an projekt and i'm already using a sass and a css folder. So can i ignore the compass create line?
That is correct, assuming you already have a config.rb file in the web root.
It's that file that tells the compiler where everything is.
The compass create command is used to generate the directories, but if you already have them you can skip that.
Add new comment