Skip to content

Instantly share code, notes, and snippets.

@ream88
Created August 27, 2012 10:39
Show Gist options
  • Save ream88/3487334 to your computer and use it in GitHub Desktop.
Save ream88/3487334 to your computer and use it in GitHub Desktop.
Sprockets/Asset Pipeline in every project
source :rubygems
gem 'actionpack', '~> 3.2', require: 'sprockets/static_compiler'
gem 'filewatcher'
gem 'rake'
gem 'sprockets'
gem 'coffee-script'
gem 'sass'
gem 'uglifier'
require 'bundler'
Bundler.require
task 'assets:precompile' do
assets = Sprockets::Environment.new('.')
Dir['assets/*'].each do |file|
assets.append_path(file)
end
FileUtils.rm_rf('public/assets', secure: true)
Sprockets::StaticCompiler.new(assets, 'public/assets', ['*'], digest: false, manifest: false).compile
end
task 'assets:live' do
FileWatcher.new(Dir['assets/*/*.*']).watch do |file|
Rake::Task['assets:precompile'].execute
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment