Class: Webpacker::Configuration
- Inherits:
-
Object
- Object
- Webpacker::Configuration
- Defined in:
- lib/webpacker/configuration.rb
Class Attribute Summary collapse
-
.installing ⇒ Object
Returns the value of attribute installing.
Instance Attribute Summary collapse
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
Instance Method Summary collapse
- #additional_paths ⇒ Object
- #cache_manifest? ⇒ Boolean
- #cache_path ⇒ Object
- #check_yarn_integrity=(value) ⇒ Object
- #compile? ⇒ Boolean
- #compiler_strategy ⇒ Object
- #dev_server ⇒ Object
- #ensure_consistent_versioning? ⇒ Boolean
- #fetch(key) ⇒ Object
-
#initialize(root_path:, config_path:, env:) ⇒ Configuration
constructor
A new instance of Configuration.
- #manifest_path ⇒ Object
- #public_manifest_path ⇒ Object
- #public_output_path ⇒ Object
- #public_path ⇒ Object
- #source_entry_path ⇒ Object
- #source_path ⇒ Object
- #webpack_compile_output? ⇒ Boolean
- #webpacker_precompile? ⇒ Boolean
Constructor Details
#initialize(root_path:, config_path:, env:) ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 |
# File 'lib/webpacker/configuration.rb', line 12 def initialize(root_path:, config_path:, env:) @root_path = root_path @config_path = config_path @env = env end |
Class Attribute Details
.installing ⇒ Object
Returns the value of attribute installing.
7 8 9 |
# File 'lib/webpacker/configuration.rb', line 7 def installing @installing end |
Instance Attribute Details
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
10 11 12 |
# File 'lib/webpacker/configuration.rb', line 10 def config_path @config_path end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
10 11 12 |
# File 'lib/webpacker/configuration.rb', line 10 def env @env end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
10 11 12 |
# File 'lib/webpacker/configuration.rb', line 10 def root_path @root_path end |
Instance Method Details
#additional_paths ⇒ Object
40 41 42 |
# File 'lib/webpacker/configuration.rb', line 40 def additional_paths fetch(:additional_paths) end |
#cache_manifest? ⇒ Boolean
68 69 70 |
# File 'lib/webpacker/configuration.rb', line 68 def cache_manifest? fetch(:cache_manifest) end |
#cache_path ⇒ Object
72 73 74 |
# File 'lib/webpacker/configuration.rb', line 72 def cache_path root_path.join(fetch(:cache_path)) end |
#check_yarn_integrity=(value) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/webpacker/configuration.rb', line 76 def check_yarn_integrity=(value) warn <<~EOS Webpacker::Configuration#check_yarn_integrity=(value) is obsolete. The integrity check has been removed from Webpacker (https://github.com/rails/webpacker/pull/2518) so changing this setting will have no effect. EOS end |
#compile? ⇒ Boolean
22 23 24 |
# File 'lib/webpacker/configuration.rb', line 22 def compile? fetch(:compile) end |
#compiler_strategy ⇒ Object
88 89 90 |
# File 'lib/webpacker/configuration.rb', line 88 def compiler_strategy fetch(:compiler_strategy) end |
#dev_server ⇒ Object
18 19 20 |
# File 'lib/webpacker/configuration.rb', line 18 def dev_server fetch(:dev_server) end |
#ensure_consistent_versioning? ⇒ Boolean
26 27 28 |
# File 'lib/webpacker/configuration.rb', line 26 def ensure_consistent_versioning? fetch(:ensure_consistent_versioning) end |
#fetch(key) ⇒ Object
92 93 94 |
# File 'lib/webpacker/configuration.rb', line 92 def fetch(key) data.fetch(key, defaults[key]) end |
#manifest_path ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/webpacker/configuration.rb', line 48 def manifest_path if data.has_key?(:manifest_path) root_path.join(fetch(:manifest_path)) else public_output_path.join("manifest.json") end end |
#public_manifest_path ⇒ Object
56 57 58 |
# File 'lib/webpacker/configuration.rb', line 56 def public_manifest_path manifest_path end |
#public_output_path ⇒ Object
64 65 66 |
# File 'lib/webpacker/configuration.rb', line 64 def public_output_path public_path.join(fetch(:public_output_path)) end |
#public_path ⇒ Object
60 61 62 |
# File 'lib/webpacker/configuration.rb', line 60 def public_path root_path.join(fetch(:public_root_path)) end |
#source_entry_path ⇒ Object
44 45 46 |
# File 'lib/webpacker/configuration.rb', line 44 def source_entry_path source_path.join(fetch(:source_entry_path)) end |
#source_path ⇒ Object
36 37 38 |
# File 'lib/webpacker/configuration.rb', line 36 def source_path root_path.join(fetch(:source_path)) end |
#webpack_compile_output? ⇒ Boolean
84 85 86 |
# File 'lib/webpacker/configuration.rb', line 84 def webpack_compile_output? fetch(:webpack_compile_output) end |
#webpacker_precompile? ⇒ Boolean
30 31 32 33 34 |
# File 'lib/webpacker/configuration.rb', line 30 def webpacker_precompile? # ENV of false takes precedence return false if %w(no false n f).include?(ENV["WEBPACKER_PRECOMPILE"]) return %w(yes true t).include?(ENV["WEBPACKER_PRECOMPILE"]) || fetch(:webpacker_precompile) end |