Sinatra Integration

Dorian edited this page Mar 3, 2016 · 2 revisions

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
  set :scss, Compass.sass_engine_options
end

get '/sass.css' do
  sass :sass_file
end

get '/scss.css' do
  scss :scss_file
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.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.