forked from adamstac/sinatra-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.rb
executable file
·36 lines (29 loc) · 917 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
25
26
27
28
29
30
31
32
33
34
35
36
# Load before Sinatra
require 'rubygems'
require 'compass' # must be loaded before sinatra
# Load Sinatra
require 'sinatra'
require 'lib/render_partial'
# Load after 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, 'public'
# Configure Compass
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
# We create /views/stylesheets where all our 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 '/about' do
haml :about, :layout => :'layouts/page'
end
get '/' do
haml :index, :layout => :'layouts/application'
end