Class: Sprockets::ProcessedAsset

Inherits:
AssetWithDependencies show all
Defined in:
lib/turbo-sprockets/sprockets_overrides/processed_asset.rb

Instance Attribute Summary

Attributes inherited from AssetWithDependencies

#dependency_digest, #source

Instance Method Summary collapse

Methods inherited from AssetWithDependencies

#encode_with, #fresh?, #init_with

Constructor Details

#initialize(environment, logical_path, pathname) ⇒ ProcessedAsset

Returns a new instance of ProcessedAsset.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/turbo-sprockets/sprockets_overrides/processed_asset.rb', line 10

def initialize(environment, logical_path, pathname)
  super

  start_time = Time.now.to_f

  context = environment.context_class.new(environment, logical_path, pathname)
  @source = context.evaluate(pathname)
  @length = Rack::Utils.bytesize(source)
  @digest = environment.digest.update(source).hexdigest

  build_required_assets(environment, context)
  build_dependency_paths(environment, context)

  @dependency_digest = compute_dependency_digest(environment)

  elapsed_time = ((Time.now.to_f - start_time) * 1000).to_i
  environment.logger.info "Compiled #{logical_path}  (#{elapsed_time}ms)  (pid #{Process.pid})"
end