Class: Webpacker::Source
- Inherits:
-
Object
- Object
- Webpacker::Source
- Defined in:
- lib/webpacker/source.rb
Overview
Translates a logical reference for a pack source into the final path needed in the HTML. This translation takes into account whether digesting is configured to happen, which it is by default in the production environment (as set via ‘Rails.configuration.x.webpacker[:digesting] = true`).
Instance Method Summary collapse
-
#initialize(name) ⇒ Source
constructor
A new instance of Source.
- #path ⇒ Object
Constructor Details
#initialize(name) ⇒ Source
Returns a new instance of Source.
6 7 8 |
# File 'lib/webpacker/source.rb', line 6 def initialize(name) @name = name end |
Instance Method Details
#path ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/webpacker/source.rb', line 10 def path if config[:dev_server_host].present? "#{config[:dev_server_host]}/#{filename}" elsif config[:digesting] File.join(dist_path, digested_filename) else File.join(dist_path, filename) end end |