Setting up Compass Rails 3.1

Ademar Tutor
Bootyard
Published in
1 min readApr 25, 2020

We’ve been using Haml and Sass ever since. Haml and Sass is great and pretty easy to setup. Here are the steps how:

Step 1: Add this to Gemfile

gem 'compass', '~> 0.12.alpha'

Step 2: Add this to your config/application.rb

stylesheets_directory = "#{Rails.root}/app/assets/stylesheets"
config.assets.precompile += Dir.glob("#{stylesheets_directory/**/*.s[ac]ss*}")
map{ |f| f[stylesheets_directory.size+1..-1]}.select do |f|
if config.assets.precompile.include?(file)
false
elsif File.basename(file)[0..1] == "_"
false
else
true
end
end
# if you prefer '.sass' over '.scss'.
config.sass.preferred_syntax = :sass

Step 3: Add this to assets/stylesheets/application.css

= require_self = require blueprint = require_directory '.'

Step 4: Smile! Your done setting up Compass with Rails 3.1

Originally published at https://www.bootyard.com on November 15, 2011

--

--