Created
June 10, 2012 16:17
-
-
Save madmax/2906434 to your computer and use it in GitHub Desktop.
Faster way to compile assets
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
require "fileutils" | |
namespace :assets do | |
namespace :precompile do | |
desc "Faster way to compile assets" | |
task fast: ["assets:environment", "tmp:cache:clear", "assets:precompile:primary"] do | |
config = Rails.application.config | |
if config.assets.digest | |
assets_path = File.join(Rails.public_path, config.assets.prefix) | |
manifest_path = config.assets.manifest || assets_path | |
manifest = YAML.load_file "#{manifest_path}/manifest.yml" | |
manifest.each do |file, digest_file| | |
FileUtils.cp "#{assets_path}/#{digest_file}", "#{assets_path}/#{file}" | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment