Class: Sprockets::StaticCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/specific_asset_compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#envObject

Returns the value of attribute env.



11
12
13
# File 'lib/specific_asset_compiler.rb', line 11

def env
  @env
end

#pathsObject

Returns the value of attribute paths.



11
12
13
# File 'lib/specific_asset_compiler.rb', line 11

def paths
  @paths
end

#targetObject

Returns the value of attribute target.



11
12
13
# File 'lib/specific_asset_compiler.rb', line 11

def target
  @target
end

Instance Method Details

#compile_specificObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/specific_asset_compiler.rb', line 13

def compile_specific
  if @manifest && File.exist?("#{@manifest_path}/manifest.yml")
    manifest = YAML.load(File.read("#{@manifest_path}/manifest.yml"))
  else
    manifest = {}
  end
  env.each_logical_path(paths) do |logical_path|
    if asset = env.find_asset(logical_path)
      digest_path = write_asset(asset)
      manifest[asset.logical_path] = digest_path
      manifest[aliased_path_for(asset.logical_path)] = digest_path
    end
  end
  write_manifest(manifest) if @manifest
end