Class: Webpack::Manifest

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/webpack/manifest.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#updated_atObject (readonly)

Returns the value of attribute updated_at.



6
7
8
# File 'lib/webpack/manifest.rb', line 6

def updated_at
  @updated_at
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:

  • (configuration)


12
13
14
# File 'lib/webpack/manifest.rb', line 12

def configure
  yield configuration
end

Instance Method Details

#find_asset(&block) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/webpack/manifest.rb', line 25

def find_asset(&block)
  chunks.inject({}) do |hash, chunk|
    filenames = [*data['assetsByChunkName'][chunk]]
    if finded = filenames.find(&block)
      hash.merge chunk => "#{host}#{finded}".strip
    else
      hash
    end
  end
end

#hostObject



36
37
38
# File 'lib/webpack/manifest.rb', line 36

def host
  data['publicPath']
end

#javascriptsObject



17
18
19
# File 'lib/webpack/manifest.rb', line 17

def javascripts
  @javascript = find_asset { |file_name| file_name.ends_with? 'js' }
end

#stylesheetsObject



21
22
23
# File 'lib/webpack/manifest.rb', line 21

def stylesheets
  @stylesheets = find_asset { |file_name| file_name.ends_with? 'css' }
end