Skip to content

Instantly share code, notes, and snippets.

@madmax
Created June 10, 2012 16:17
Show Gist options
  • Save madmax/2906434 to your computer and use it in GitHub Desktop.
Save madmax/2906434 to your computer and use it in GitHub Desktop.
Faster way to compile assets
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