Class: Sprockets::Webpack::WebpackDirectiveProcessor

Inherits:
DirectiveProcessor
  • Object
show all
Defined in:
lib/sprockets/webpack/webpack_directive_processor.rb

Instance Method Summary collapse

Instance Method Details

#_call(_) ⇒ Object



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

def _call(_)
  result = super
  super.merge(data: result[:data] + "\n\n\n" + @webpack_data)
end

#process_require_webpack_tree_directive(path = '.') ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sprockets/webpack/webpack_directive_processor.rb', line 7

def process_require_webpack_tree_directive(path = '.')
  absolute_path = expand_relative_dirname(:require_tree, path)
  entry = entry_from_absolute_path(absolute_path)

  add_path_to_dependencies_list(absolute_path)
  add_webpack_config_to_dependencies_list

  compiled = driver_for(entry).compile
  logger.info "WEBPACK: #{compiled.benchmark}"

  assert_no_errors(compiled.errors)

  @webpack_data = compiled.data
end