This commit is contained in:
Scott Davis 2011-10-09 11:34:39 -04:00
parent 3337b07ec7
commit ebb2e42acc

View File

@ -9,6 +9,13 @@ classnames:
## Ruby on Rails ## Ruby on Rails
### Rails 3.1
Just add compass to your Gemfile like so:
gem 'compass'
Also checkout this [gist](https://gist.github.com/1184843)
### Rails 3 ### Rails 3
compass init rails /path/to/myrailsproject compass init rails /path/to/myrailsproject
### Rails 2.3 ### Rails 2.3
@ -16,26 +23,26 @@ classnames:
## Sinatra ## Sinatra
require 'compass'
require 'sinatra' require 'sinatra'
require 'haml' require 'haml'
require 'sass'
require 'compass'
configure do configure do
Compass.configuration do |config| set :haml, {:format => :html5, :escape_html => true}
config.project_path = File.dirname(__FILE__) set :scss, {:style => :compact, :debug_info => false}
config.sass_dir = 'views' Compass.add_project_configuration(File.join(Sinatra::Application.root, 'config', 'compass.rb'))
end
set :haml, { :format => :html5 }
set :sass, Compass.sass_engine_options
end end
get '/screen.css' do get '/stylesheets/:name.css' do
content_type 'text/css', :charset => 'utf-8' content_type 'text/css', :charset => 'utf-8'
sass :screen scss(:"stylesheets/#{params[:name]}" )
end end
get '/' do
haml :index
end
If you keep your stylesheets in “views/stylesheets/” directory instead of just “views/”, remember to update sass_dir configuration accordingly. If you keep your stylesheets in “views/stylesheets/” directory instead of just “views/”, remember to update sass_dir configuration accordingly.
Check out this [sample compass-sinatra project](http://github.com/chriseppstein/compass-sinatra) to get up and running in no time! Check out this [sample compass-sinatra project](http://github.com/chriseppstein/compass-sinatra) to get up and running in no time!