mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
25 lines
714 B
Ruby
25 lines
714 B
Ruby
namespace :assets do
|
|
desc "Compile all the assets named in config.assets.precompile"
|
|
task :precompile do
|
|
if ENV["RAILS_GROUPS"].to_s.empty?
|
|
ENV["RAILS_GROUPS"] = "assets"
|
|
Kernel.exec $0, *ARGV
|
|
else
|
|
Rake::Task["environment"].invoke
|
|
Sprockets::Helpers::RailsHelper
|
|
|
|
assets = Rails.application.config.assets.precompile
|
|
Rails.application.assets.precompile(*assets)
|
|
end
|
|
end
|
|
|
|
desc "Remove compiled assets"
|
|
task :clean => :environment do
|
|
assets = Rails.application.config.assets
|
|
public_asset_path = Rails.public_path + assets.prefix
|
|
file_list = FileList.new("#{public_asset_path}/**/*")
|
|
file_list.each do |file|
|
|
rm_rf file
|
|
end
|
|
end
|
|
end
|