Module: Webpack

Defined in:
lib/webpack.rb,
lib/webpack/rails.rb,
lib/webpack/view_helpers.rb,
lib/webpack/configuration.rb,
lib/webpack/assets/version.rb

Defined Under Namespace

Modules: Assets, ViewHelpers Classes: Configuration

Class Method Summary collapse

Class Method Details

.configWebpack::Configuration



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

def config
  @config ||= Configuration.new
end

.configure {|| ... } ⇒ Object

Examples:

Webpack.configure do |config|
  config.port = 4000
  config.path = '/assets'
end

Yields:

  • config

Yield Parameters:



18
19
20
21
# File 'lib/webpack.rb', line 18

def configure
  yield config
  config.validate!
end

.fetch_entry(name, ext) ⇒ String

Parameters:

  • name (String)
  • ext (String)

Returns:

  • (String)


35
36
37
38
39
40
# File 'lib/webpack.rb', line 35

def fetch_entry(name, ext)
  entries = @entries[name]
  entry = entries[ext] if entries
  fail "#{name}.#{ext} does not exist" unless entry
  entry
end

.fetch_static_file(path) ⇒ String

Parameters:

  • path (String)

Returns:

  • (String)


49
50
51
52
53
# File 'lib/webpack.rb', line 49

def fetch_static_file(path)
  static_file = @static_files[path]
  fail "#{path} does not exist" unless static_file
  static_file
end

.load_entries(entries) ⇒ Object

Parameters:

  • entries (Hash)


28
29
30
# File 'lib/webpack.rb', line 28

def load_entries(entries)
  @entries = entries
end

.load_static_files(static_files) ⇒ Object

Parameters:

  • static_files (Hash)


43
44
45
# File 'lib/webpack.rb', line 43

def load_static_files(static_files)
  @static_files = static_files
end

.resetObject



23
24
25
# File 'lib/webpack.rb', line 23

def reset
  @config = nil
end