Skip to content

Commit bc2643f

Browse files
committedJul 7, 2013
Add init.js compilation
1 parent 5663292 commit bc2643f

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed
 

‎Rakefile

+18-16
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,23 @@ task :stats do
3131
puts "Users: #{resource_count('user')}"
3232
end
3333

34-
desc "Compile javascript pixel library"
34+
desc "Compile javascript files"
3535
task :compile do
36-
library_path = 'public/javascripts/pixel.js'
37-
output_path = "#{library_path.gsub(/\.js$/, '')}.min.js"
38-
39-
puts "Compiling #{library_path}"
40-
uri = URI('http://closure-compiler.appspot.com/compile')
41-
options = {
42-
'js_code' => File.open(library_path).read,
43-
'compilation_level' => 'SIMPLE_OPTIMIZATIONS',
44-
'output_format' => 'text',
45-
'output_info' => 'compiled_code'
46-
}
47-
res = Net::HTTP.post_form(uri, options)
48-
49-
puts "Writing compiled code to #{output_path}"
50-
File.open(output_path, 'w') {|f| f.write(res.body)}
36+
['pixel.js', 'init.js'].each do |file|
37+
library_path = "public/javascripts/#{file}"
38+
output_path = "#{library_path.gsub(/\.js$/, '')}.min.js"
39+
40+
puts "Compiling #{library_path}"
41+
uri = URI('http://closure-compiler.appspot.com/compile')
42+
options = {
43+
'js_code' => File.open(library_path).read,
44+
'compilation_level' => 'SIMPLE_OPTIMIZATIONS',
45+
'output_format' => 'text',
46+
'output_info' => 'compiled_code'
47+
}
48+
res = Net::HTTP.post_form(uri, options)
49+
50+
puts "Writing compiled code to #{output_path}"
51+
File.open(output_path, 'w') {|f| f.write(res.body)}
52+
end
5153
end

0 commit comments

Comments
 (0)
Please sign in to comment.