Skip to content
Browse files

Add rake task to implement assets:cleanup, fixes Github Issues # 1284

  • Loading branch information...
1 parent d1c7470 commit 9d10c2a03d3f1c25a76528e1e99be2930efcd2ad @bhavinkamani bhavinkamani committed with gnufied May 27, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 railties/lib/rails/tasks/assets.rake
View
10 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

0 comments on commit 9d10c2a

Please sign in to comment.
Something went wrong with that request. Please try again.