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
|
# File 'lib/githubbish_assets/packer.rb', line 5
def self.js
case GithubbishAssets.js_compressor
when :jsmin
require 'vendor/js_minimizer'
when :closure
require 'closure-compiler'
end
pack(Rails.root + 'public/javascripts', '.js') do |target, files|
case GithubbishAssets.js_compressor
when :closure
opts = { :js_output_file => target, :js => files }
if GithubbishAssets.closure_source_map
opts[:create_source_map] = "#{target}.map"
end
Closure::Compiler.new(opts).compile('')
when :yui
compress_with_yui(YUI::JavaScriptCompressor.new, files, target)
else
File.open(target, 'w+') do |f|
f.puts GithubbishAssets::JSMinimizer.minimize_files(*files)
end
end
end
end
|