sass-site/config.ru

39 lines
959 B
Plaintext
Raw Normal View History

2012-09-27 12:26:50 +02:00
require "rubygems"
2013-10-13 01:53:19 +02:00
require "rack/rewrite"
require "rack/ssl"
2013-10-17 05:46:28 +02:00
require "rack/contrib/not_found"
require "rack/contrib/try_static"
use Rack::SSL if ENV["HEROKU"] == 'true'
use Rack::Rewrite do
r301 %r{/docs/yardoc/(.*)}, '/documentation/$1'
r301 '/tutorial.html', '/guide'
r301 '/download.html', '/install'
r301 '/documentation', '/documentation/'
r301 '/documentation/_index.html', '/documentation/'
2013-10-15 22:53:50 +02:00
r301 '/try', 'http://sassmeister.com'
r301 '/try.html', 'http://sassmeister.com'
r301 '/about', '/'
r301 '/about.html', '/'
end
2013-10-17 05:51:08 +02:00
use Rack::Deflater
if ENV["HEROKU"].nil? || ENV["HEROKU"] == 'false'
require "middleman"
2013-10-17 05:46:28 +02:00
server = Middleman.server
run Rack::Cascade.new([
server,
lambda {|env| server.call(env.merge!('PATH_INFO' => '/404'))}
])
else
2013-10-17 05:46:28 +02:00
use Rack::TryStatic,
:urls => ["/"], :root => 'build', :index => 'index.html',
:try => ['.html', '/index.html']
2013-10-17 05:46:28 +02:00
run Rack::NotFound.new("build/404/index.html")
end