Module: Webpack::Manifest

Defined in:
lib/webpack/manifest.rb,
lib/webpack/manifest/entries.rb,
lib/webpack/manifest/configuration.rb

Defined Under Namespace

Classes: Configuration, Entries

Class Method Summary collapse

Class Method Details

.configObject



10
11
12
# File 'lib/webpack/manifest.rb', line 10

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



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

def configure
  yield config
end

.load(path) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/webpack/manifest.rb', line 14

def load(path)
  # read file
  uri = URI.parse(path.to_s)
  str = case uri
        when URI::HTTP, URI::HTTPS
          OpenURI.open_uri(uri.to_s).read
        else # default read file
          File.read(uri.path)
        end

  # to json
  entries = JSON.parse str

  # return Manifest instance
  Entries.new entries
end