mirror of
https://github.com/danog/sass-site.git
synced 2024-11-27 04:24:50 +01:00
40 lines
1011 B
Ruby
40 lines
1011 B
Ruby
require "rubygems"
|
|
|
|
require "rack/rewrite"
|
|
require "rack/ssl"
|
|
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/'
|
|
r301 '/try', 'http://sassmeister.com'
|
|
r301 '/try.html', 'http://sassmeister.com'
|
|
r301 '/about', '/'
|
|
r301 '/about.html', '/'
|
|
r301 %r{/blog/(.*)}, 'http://sass.logdown.com/$1'
|
|
end
|
|
|
|
use Rack::Deflater
|
|
|
|
if ENV["HEROKU"].nil? || ENV["HEROKU"] == 'false'
|
|
require "middleman"
|
|
|
|
server = Middleman.server
|
|
run Rack::Cascade.new([
|
|
server,
|
|
lambda {|env| server.call(env.merge!('PATH_INFO' => '/404'))}
|
|
])
|
|
else
|
|
use Rack::TryStatic,
|
|
:urls => ["/"], :root => 'build', :index => 'index.html',
|
|
:try => ['.html', '/index.html']
|
|
|
|
run Rack::NotFound.new("build/404/index.html")
|
|
end
|