Skip to content

Instantly share code, notes, and snippets.

@PriteshJain
Created September 10, 2012 19:14
Show Gist options
  • Save PriteshJain/3693101 to your computer and use it in GitHub Desktop.
Save PriteshJain/3693101 to your computer and use it in GitHub Desktop.
rack server with sprockets and less compressor
#Rack server default at 0.0.0.0:9292
require 'sprockets'
require "sprockets-less"
require "less"
project_root = File.expand_path(File.dirname(__FILE__))
assets = Sprockets::Environment.new(project_root) do |env|
env.logger = Logger.new(STDOUT)
end
assets.append_path('app/assets/stylesheets/')
map "/assets" do
run assets
end
map "/" do
run lambda { |env|
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open('public/index.html', File::RDONLY)
]
}
end
source 'https://rubygems.org'
gem "sprockets"
gem "sprockets-less"
gem "less"
gem 'therubyracer'
#This file is created to easily install all required gems at once with dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment