Instantly share code, notes, and snippets.

Embed
What would you like to do?
http_path = "/"
http_stylesheets_path = "/stylesheets"
http_images_path = "/images"
http_javascripts_path = "/javascripts"
sass_dir = "sass"
css_dir = "public/stylesheets"
images_dir = "public/images"
javascripts_dir = "public/javascripts"
relative_assets = false
#\ -p 4000
gem 'activesupport', '>= 2.3.5' # version required by Serve
gem 'serve', '>= 0.11.6'
require 'serve'
require 'serve/rack'
require 'sass/plugin/rack'
require 'compass'
# The project root directory
root = ::File.dirname(__FILE__)
# Compass
Compass.add_project_configuration(root + '/compass.config')
Compass.configure_sass_plugin!
# Middleware
use Rack::ShowStatus # Nice looking 404s and other messages
use Rack::ShowExceptions # Nice looking errors
use Sass::Plugin::Rack # Compile Sass on the fly
# Rack Application
if ENV['SERVER_SOFTWARE'] =~ /passenger/i
# Passenger only needs the adapter
run Serve::RackAdapter.new(root + '/views')
else
# We use Rack::Cascade and Rack::Directory on other platforms to
# handle static assets
run Rack::Cascade.new([
Serve::RackAdapter.new(root + '/views'),
Rack::Directory.new(root + '/public')
])
end

This assumes the following directory structure:

project/
  |
  +-- config.ru
  |
  +-- compass.config
  |
  +-- public/
  |    |
  |    +-- stylesheets/
  |    |
  |    +-- images/
  |    |
  |    +-- javascripts/
  |
  +-- sass/
  |
  +-- tmp/
  |
  +-- views/
@jlong

This comment has been minimized.

Show comment
Hide comment
@jlong

jlong May 27, 2010

This assumes the following directory structure:

project/
  |
  +-- config.ru
  |
  +-- compass.config
  |
  +-- public/
  |    |
  |    +-- stylesheets/
  |         |
  |         +-- sass/
  |
  +-- tmp/
  |
  +-- views/
Owner

jlong commented May 27, 2010

This assumes the following directory structure:

project/
  |
  +-- config.ru
  |
  +-- compass.config
  |
  +-- public/
  |    |
  |    +-- stylesheets/
  |         |
  |         +-- sass/
  |
  +-- tmp/
  |
  +-- views/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment