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
|
# File 'lib/guard/cogs.rb', line 8
def initialize(watchers = [], options = {})
super
@compile = options[:compile]
@dest = options[:dest] || '.'
if options[:sprockets].nil?
@sprockets = ::Sprockets::Environment.new
@sprockets.cache = {}
if options[:minify] == true
begin
require 'uglifier'
@sprockets.js_compressor = ::Uglifier.new
rescue LoadError
throw 'Uglifier cannot be loaded. Please include "uglifier" in your Gemfile.'
end
begin
require 'yui/compressor'
@sprockets.css_compressor = ::YUI::CssCompressor.new
rescue LoadError
throw 'YUI Compressor cannot be loaded. Please include "yui/compressor" in your Gemfile.'
end
end
else
@sprockets = options[:sprockets]
end
asset_paths = options[:asset_paths] ? Array(options[:asset_paths]) : ['.']
asset_paths.each {|p| @sprockets.append_path(p)}
end
|