forked from metafizzy/isotope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
35 lines (33 loc) · 1.04 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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 do
unless File.exists?( compiler )
puts "ERROR: Compiler not found at " + compiler
else
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..9].join()
f.write min
end
end
end
desc "Zips _site/ into isotope-site.zip on to Desktop"
task :zip do
# makes isotope-site/ directory
sh 'mkdir isotope-site;'
# copies _site/
sh 'cp -r _site/ isotope-site;'
# zips isotope-site/
sh 'zip -r ~/Desktop/isotope-site.zip isotope-site/;'
# removes isotope-site/
sh 'rm -rf isotope-site;'
end