-
Notifications
You must be signed in to change notification settings - Fork 6
Using Compass with ruby slippers
Based on this: http://wiseheartdesign.com/articles/2010/06/07/compass-with-serve-and-rack/
First add the compass gem to your Gemfile and do bundle install
gem 'compass'
Edit your config.rb and add these lines after requiring the ruby-slippers gem:
require 'sass/plugin/rack'
require 'compass'
# Compass
Compass.add_project_configuration("compass.config") #you can change the filename/path here
Compass.configure_sass_plugin!
use Sass::Plugin::Rack # Compile Sass on the fly
next, create a compass.config file in the same folder as your config.rb(or whatever path you put in your project config line) and add these configuration options:
http_path = "/"
http_stylesheets_path = "/stylesheets"
http_images_path = "/images"
http_javascripts_path = "/javascripts"
sass_dir = "sass"
css_dir = "public/css"
images_dir = "public/img"
javascripts_dir = "public/js"
relative_assets = false
The *_dir options all point to where your assets are located(ruby-slippers in this case has set them to css, img, and js respectively).
As a side note, if you're using heroku you need to point your stylesheet directory to /tmp as it is the only writable folder in heroku(unless you are not compiling on the fly, in which case, you can just push your compiled css)