Class: BrowserifyRails::BrowserifyProcessor
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- BrowserifyRails::BrowserifyProcessor
- Defined in:
- lib/browserify-rails/browserify_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) ⇒ BrowserifyProcessor
constructor
A new instance of BrowserifyProcessor.
- #prepare ⇒ Object
Constructor Details
#initialize(template) ⇒ BrowserifyProcessor
Returns a new instance of BrowserifyProcessor.
11 12 13 14 |
# File 'lib/browserify-rails/browserify_processor.rb', line 11 def initialize(template) self.config = Rails.application.config.browserify_rails super(template) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
9 10 11 |
# File 'lib/browserify-rails/browserify_processor.rb', line 9 def config @config end |
Instance Method Details
#evaluate(context, locals, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/browserify-rails/browserify_processor.rb', line 21 def evaluate(context, locals, &block) # If there's nothing to do, we just return the data we received return data unless should_browserify? # Signal dependencies to sprockets to ensure we track changes evaluate_dependencies(context.environment.paths).each do |path| context.depend_on(path) end run_browserify(context.logical_path) end |
#prepare ⇒ Object
16 17 18 19 |
# File 'lib/browserify-rails/browserify_processor.rb', line 16 def prepare ensure_tmp_dir_exists! ensure_commands_exist! end |