forked from seaofclouds/compass-sinatra
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathapp.rb
24 lines (20 loc) · 736 Bytes
/
app.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'rubygems'
require 'compass' #must be loaded before sinatra
require 'sinatra'
require 'haml' #must be loaded after sinatra
# set sinatra's variables
set :app_file, __FILE__
set :root, File.dirname(__FILE__)
set :views, "views"
set :public, 'static'
configure do
Compass.add_project_configuration(File.join(Sinatra::Application.root, 'config', 'compass.config'))
end
# at a minimum, the main sass file must reside within the ./views directory. here, we create a ./views/stylesheets directory where all of the sass files can safely reside.
get '/stylesheets/:name.css' do
content_type 'text/css', :charset => 'utf-8'
sass(:"stylesheets/#{params[:name]}", Compass.sass_engine_options )
end
get '/' do
haml :index
end