-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapp.rb
53 lines (40 loc) · 732 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'rubygems'
require 'sinatra'
require 'haml'
require 'sass'
Dir["lib/**/*.rb"].each {|f| require "./#{f}"}
#
# Configuration
#
# Allow rendering of partials. See: https://gist.github.com/119874
helpers Sinatra::Partials
configure do
# Default Haml format is :xhtml
set :haml, { :format => :html5 }
end
configure :development do
require "sinatra/reloader"
end
configure :production do
set :haml, { :ugly => true }
end
#
# Helpers
#
helpers do
include Rack::Utils
alias_method :h, :escape_html
end
#
# Routes
#
not_found do
redirect '/404.html'
end
get '/stylesheets/:name.css' do
content_type 'text/css', :charset => 'utf-8'
scss :"stylesheets/#{params[:name]}"
end
get "/" do
haml :index
end