Class: Guard::Sprockets2::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/sprockets2/compiler.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Compiler

Returns a new instance of Compiler.



3
4
5
6
# File 'lib/guard/sprockets2/compiler.rb', line 3

def initialize(options = {})
  configure(options)
  @target = Pathname.new(@assets_path)
end

Instance Method Details

#cleanObject



8
9
10
# File 'lib/guard/sprockets2/compiler.rb', line 8

def clean
  FileUtils.rm_rf @assets_path, :secure => true
end

#compileObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/guard/sprockets2/compiler.rb', line 12

def compile
  @sprockets.send(:expire_index!)
  success = true
  @precompile.each do |path|
    @sprockets.each_logical_path do |logical_path|
      next unless path_matches?(path, logical_path)

      if asset = @sprockets.find_asset(logical_path)
        success = compile_asset(asset)
        break unless success
      end
    end
  end
  success
end