From 7882ed214b44c75d30b9c2993c78749f1d8e8923 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 24 Jan 2011 12:58:42 -0500 Subject: [PATCH] Add Rakefile for automating minification --- Rakefile | 21 +++++++++++++++++++++ _config.yml | 1 + 2 files changed, 22 insertions(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..45bebe9 --- /dev/null +++ b/Rakefile @@ -0,0 +1,21 @@ +# automates minifying jquery.isotope.js +# 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 + 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 min + end +end + diff --git a/_config.yml b/_config.yml index 5bc1338..78b3671 100644 --- a/_config.yml +++ b/_config.yml @@ -1,6 +1,7 @@ name: Isotope permalink: /:categories/:title.html pygments: true +exclude: [ Rakefile ] elements: - categories: [alkali, metal]