public
Description: Compass is a Stylesheet Authoring Environment that makes your website design simpler to implement and easier to maintain.
Home | Edit | New

Sinatra Integration

A minimal Sinatra app preconfigured for Compass:

require 'sinatra'
require 'haml'
require 'sass'
require 'compass'

configure do
  Compass.configuration do |config|
    config.project_path = File.dirname(__FILE__)
    config.sass_dir = 'views'
  end
  
  set :haml, { :format => :html5 }
  set :sass, Compass.sass_engine_options
end

get '/screen.css' do
  content_type 'text/css', :charset => 'utf-8'
  sass :screen
end

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 to get up and running in no time!

Sinatra Projects:

  • Sinatra Bootstrap – a base Sinatra project with support for Haml, Sass, Compass, jQuery and more.
Last edited by adamstac, Tue Nov 03 17:35:20 -0800 2009
Home | Edit | New
Versions: