diff options
author | Bhavin Kamani <bhavinkamani@gmail.com> | 2011-05-27 12:59:54 +0530 |
---|---|---|
committer | Hemant Kumar <gethemant@gmail.com> | 2011-05-27 14:00:20 +0530 |
commit | 9d10c2a03d3f1c25a76528e1e99be2930efcd2ad (patch) | |
tree | 659c939f6214e032111aa8be0982845e807f403e /railties/lib/rails | |
parent | d1c74706c35b0b17b22c4b2541353d1b9ac6bfa5 (diff) | |
download | rails-9d10c2a03d3f1c25a76528e1e99be2930efcd2ad.tar.gz rails-9d10c2a03d3f1c25a76528e1e99be2930efcd2ad.tar.bz2 rails-9d10c2a03d3f1c25a76528e1e99be2930efcd2ad.zip |
Add rake task to implement assets:cleanup, fixes Github Issues # 1284
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/tasks/assets.rake | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/railties/lib/rails/tasks/assets.rake b/railties/lib/rails/tasks/assets.rake index 5d2f02af13..1168409dcb 100644 --- a/railties/lib/rails/tasks/assets.rake +++ b/railties/lib/rails/tasks/assets.rake @@ -1,3 +1,5 @@ +require "fileutils" + namespace :assets do desc "Compile all the assets named in config.assets.precompile" task :precompile => :environment do @@ -7,4 +9,12 @@ namespace :assets do assets = Rails.application.config.assets.precompile Rails.application.assets.precompile(*assets) end + + desc "Remove compiled assets" + task :cleanup => :environment do + assets = Rails.application.config.assets + public_asset_path = Rails.public_path + assets.prefix + FileUtils.rm_r Dir.glob("#{public_asset_path}/*.js") + FileUtils.rm_r Dir.glob("#{public_asset_path}/*.css") + end end |