Class: Hanami::Assets::Bundler Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/assets/bundler.rb,
lib/hanami/assets/bundler/asset.rb,
lib/hanami/assets/bundler/compressor.rb,
lib/hanami/assets/bundler/manifest_entry.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Bundle assets from a single application.

Since:

  • 0.1.0

Defined Under Namespace

Classes: Asset, Compressor, ManifestEntry

Constant Summary collapse

DEFAULT_PERMISSIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

0o644
URL_SEPARATOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

"/"
URL_REPLACEMENT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

""

Instance Method Summary collapse

Constructor Details

#initialize(configuration, duplicates) ⇒ Hanami::Assets::Bundler

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a new instance

Parameters:

Since:

  • 0.1.0



40
41
42
43
44
# File 'lib/hanami/assets/bundler.rb', line 40

def initialize(configuration, duplicates)
  @manifest       = Hash[]
  @configuration  = configuration
  @duplicates     = duplicates
end

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Start the process.

For each asset contained in the sources and third party gems, it will:

* Compress
* Create a fingerprinted version of the file
* Generate a subresource integrity digest

At the end it will generate a manifest



59
60
61
62
63
64
65
66
67
68
# File 'lib/hanami/assets/bundler.rb', line 59

def run
  assets.each do |path|
    unless File.directory?(path)
      configuration = _configuration_for(path)
      process(Asset.new(path, configuration))
    end
  end

  write_manifest_file
end