Skip to content

Commit

Permalink
Rakefile : revise to overwrite previous file
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed Jan 25, 2011
1 parent e2510b4 commit 61adc10
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Rakefile
@@ -1,20 +1,19 @@
# automates minifying jquery.isotope.js
# requires Google Closure Compiler http://code.google.com/closure/compiler/
# from command line run:
# rake min COMPILER='path/to/compiler.jar'
file compiler = ENV["COMPILER"] || '~/resources/google-closure/compiler.jar'
js = 'jquery.isotope.js'
min_js = 'jquery.isotope.min.js'

desc "Generates #{min_js}"
task :min => min_js

file min_js => compiler do
task :min do
puts "Minifying jquery.isotope.js..."
sh "java -jar #{compiler} --js #{js} --js_output_file #{min_js}"
# Adds header comment
min = File.read( min_js )
File.open( min_js, 'w') do |f|
f.write File.readlines( js )[0..5].join()
f.write File.readlines( js )[0..9].join()
f.write min
end
end
Expand Down

0 comments on commit 61adc10

Please sign in to comment.