Skip to content

Instantly share code, notes, and snippets.

@beastaugh
Created July 23, 2008 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beastaugh/1941 to your computer and use it in GitHub Desktop.
Save beastaugh/1941 to your computer and use it in GitHub Desktop.
Delete minified and concatenated CSS and JS files
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