Class: SprocketsCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/fanforce/app_factory/sprockets/compiler.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SprocketsCompiler

This is pretty much copy/paste from github.com/stevehodgkiss/guard-sprockets2/blob/master/lib/guard/sprockets2/compiler.rb The only method added/changed is self.sprockets()



10
11
12
13
# File 'lib/fanforce/app_factory/sprockets/compiler.rb', line 10

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

Instance Method Details

#cleanObject



15
16
17
# File 'lib/fanforce/app_factory/sprockets/compiler.rb', line 15

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

#compileObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fanforce/app_factory/sprockets/compiler.rb', line 19

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, false)
        success = compile_asset(asset, true) if @digest
        break unless success
      end
    end
  end
  success
end