2011-03-21 19:05:56 -04:00
|
|
|
namespace :assets do
|
2011-04-18 05:18:37 -04:00
|
|
|
desc "Compile all the assets named in config.assets.precompile"
|
|
|
|
task :precompile => :environment do
|
2011-04-19 14:06:09 -04:00
|
|
|
# Give assets access to asset_path
|
2011-05-25 14:35:18 -04:00
|
|
|
Sprockets::Helpers::RailsHelper
|
2011-04-19 14:06:09 -04:00
|
|
|
|
2011-03-30 23:00:16 -04:00
|
|
|
assets = Rails.application.config.assets.precompile
|
2011-03-22 17:24:01 -04:00
|
|
|
Rails.application.assets.precompile(*assets)
|
2011-03-21 19:05:56 -04:00
|
|
|
end
|
2011-05-27 03:29:54 -04:00
|
|
|
|
|
|
|
desc "Remove compiled assets"
|
2011-05-27 10:42:11 -04:00
|
|
|
task :clean => :environment do
|
2011-05-27 03:29:54 -04:00
|
|
|
assets = Rails.application.config.assets
|
|
|
|
public_asset_path = Rails.public_path + assets.prefix
|
2011-05-27 10:42:11 -04:00
|
|
|
file_list = FileList.new("#{public_asset_path}/*.js", "#{public_asset_path}/*.css")
|
2011-05-30 01:56:11 -04:00
|
|
|
file_list.each{ |file| rm file }
|
2011-05-27 03:29:54 -04:00
|
|
|
end
|
2011-03-21 19:05:56 -04:00
|
|
|
end
|