Class: Webpacker::Manifest
- Inherits:
-
Object
- Object
- Webpacker::Manifest
- Defined in:
- lib/webpacker/manifest.rb
Overview
Singleton registry for accessing the packs path using a generated manifest. This allows javascript_pack_tag, stylesheet_pack_tag, asset_pack_path to take a reference to, say, “calendar.js” or “calendar.css” and turn it into “/packs/calendar-1016838bab065ae1e314.js” or “/packs/calendar-1016838bab065ae1e314.css”.
When the configuration is set to on-demand compilation, with the ‘compile: true` option in the webpacker.yml file, any lookups will be preceeded by a compilation if one is needed.
Defined Under Namespace
Classes: MissingEntryError
Instance Method Summary collapse
-
#initialize(webpacker) ⇒ Manifest
constructor
A new instance of Manifest.
- #lookup(name) ⇒ Object
- #lookup!(name) ⇒ Object
- #refresh ⇒ Object
Constructor Details
#initialize(webpacker) ⇒ Manifest
Returns a new instance of Manifest.
13 14 15 |
# File 'lib/webpacker/manifest.rb', line 13 def initialize(webpacker) @webpacker = webpacker end |
Instance Method Details
#lookup(name) ⇒ Object
21 22 23 24 |
# File 'lib/webpacker/manifest.rb', line 21 def lookup(name) compile if compiling? find name end |
#lookup!(name) ⇒ Object
26 27 28 |
# File 'lib/webpacker/manifest.rb', line 26 def lookup!(name) lookup(name) || handle_missing_entry(name) end |
#refresh ⇒ Object
17 18 19 |
# File 'lib/webpacker/manifest.rb', line 17 def refresh @data = load end |