-
Notifications
You must be signed in to change notification settings - Fork 207
/
Rakefile
57 lines (50 loc) · 1.29 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# special thanks to https://github.com/tuupola/jquery_lazyload for this cool Rakefile
task :default => [:minify]
desc "coffee2js"
task :coffee2js do
coffee2js
end
desc "Minify"
task :minify do
minify
end
desc "Build"
task :build do
coffee2js
minify
end
# method definitions
def coffee2js
begin
require 'coffee-script'
rescue LoadError => e
if verbose
puts "\nYou'll need the 'coffee-script' gem for translate the coffeescript file to js. Just run:\n\n"
puts " $ gem install coffee-script"
puts "\nand you should be all set.\n\n"
exit
end
return false
end
puts "Translating jquery.bootstrap-growl.coffee to jquery.bootstrap-growl.js..."
File.open("jquery.bootstrap-growl.js", "w") do |f|
f.puts CoffeeScript.compile(File.read("jquery.bootstrap-growl.coffee"))
end
end
def minify
begin
require 'uglifier'
rescue LoadError => e
if verbose
puts "\nYou'll need the 'uglifier' gem for minification. Just run:\n\n"
puts " $ gem install uglifier"
puts "\nand you should be all set.\n\n"
exit
end
return false
end
puts "Minifying jquery.bootstrap-growl.js with UglifyJS..."
File.open("jquery.bootstrap-growl.min.js", "w") do |f|
f.puts Uglifier.new.compile(File.read("jquery.bootstrap-growl.js"))
end
end