1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/tasks/assets.rake

27 lines
765 B
Ruby
Raw Normal View History

2011-03-21 19:05:56 -04:00
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
2011-03-21 19:05:56 -04:00
end
desc "Remove compiled assets"
2011-05-27 10:42:11 -04:00
task :clean => :environment do
assets = Rails.application.config.assets
public_asset_path = Rails.public_path + assets.prefix
2011-06-19 21:03:55 -04:00
file_list = FileList.new("#{public_asset_path}/**/*")
2011-06-07 15:58:40 -04:00
file_list.each do |file|
rm file, :force => true
2011-06-07 15:58:40 -04:00
rm "#{file}.gz", :force => true
end
end
2011-03-21 19:05:56 -04:00
end