Created
July 23, 2008 23:33
-
-
Save beastaugh/1941 to your computer and use it in GitHub Desktop.
Delete minified and concatenated CSS and JS files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'find' | |
require 'rubygems' | |
require 'rake' | |
desc "Remove minified CSS and JS files from this directory and its children." | |
task :killmin do | |
Find.find(File.dirname(__FILE__)) do |path| | |
if FileTest.directory?(path) | |
if File.basename(path)[0] == ?. | |
Find.prune # Don't look any further into this directory. | |
else | |
next | |
end | |
else | |
if File.ftype(path) == "file" && path =~ /(concatenated|-min)\.(css|js)$/ | |
begin | |
File.delete(path) | |
puts "Deleted #{path}" | |
rescue | |
puts "Couldn't delete #{path}" | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment