Class: WebpackRails::WebpackProcessor
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- WebpackRails::WebpackProcessor
- Defined in:
- lib/webpackrails/webpack_processor.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #evaluate(context, locals, &block) ⇒ Object
-
#initialize(template) ⇒ WebpackProcessor
constructor
A new instance of WebpackProcessor.
- #prepare ⇒ Object
Constructor Details
#initialize(template) ⇒ WebpackProcessor
Returns a new instance of WebpackProcessor.
13 14 15 16 |
# File 'lib/webpackrails/webpack_processor.rb', line 13 def initialize(template) self.config = Rails.application.config.webpackrails super(template) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
11 12 13 |
# File 'lib/webpackrails/webpack_processor.rb', line 11 def config @config end |
Instance Method Details
#evaluate(context, locals, &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/webpackrails/webpack_processor.rb', line 24 def evaluate(context, locals, &block) # return if there is nothing to do return data unless should_webpack? evaluated = run_webpack(context.pathname || context.logical_path) evaluate_dependencies(context.environment.paths).each do |path| context.depend_on(path.to_s) end evaluated end |
#prepare ⇒ Object
18 19 20 21 22 |
# File 'lib/webpackrails/webpack_processor.rb', line 18 def prepare ensure_tmp_dir_exists! ensure_commands_exists! ensure_webpack_config_exists! end |