Created
September 10, 2012 19:14
-
-
Save PriteshJain/3693101 to your computer and use it in GitHub Desktop.
rack server with sprockets and less compressor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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