Class: Webpacker::Instance
- Inherits:
-
Object
- Object
- Webpacker::Instance
- Defined in:
- lib/webpacker/instance.rb
Instance Attribute Summary collapse
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
Instance Method Summary collapse
- #commands ⇒ Object
- #compiler ⇒ Object
- #config ⇒ Object
- #dev_server ⇒ Object
- #env ⇒ Object
-
#initialize(root_path: Rails.root, config_path: Rails.root.join("config/webpacker.yml")) ⇒ Instance
constructor
A new instance of Instance.
- #inlining_css? ⇒ Boolean
- #manifest ⇒ Object
- #strategy ⇒ Object
Constructor Details
#initialize(root_path: Rails.root, config_path: Rails.root.join("config/webpacker.yml")) ⇒ Instance
Returns a new instance of Instance.
7 8 9 10 |
# File 'lib/webpacker/instance.rb', line 7 def initialize(root_path: Rails.root, config_path: Rails.root.join("config/webpacker.yml")) @root_path = root_path @config_path = Pathname.new(ENV["WEBPACKER_CONFIG"] || config_path) end |
Instance Attribute Details
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
5 6 7 |
# File 'lib/webpacker/instance.rb', line 5 def config_path @config_path end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
5 6 7 |
# File 'lib/webpacker/instance.rb', line 5 def root_path @root_path end |
Instance Method Details
#commands ⇒ Object
40 41 42 |
# File 'lib/webpacker/instance.rb', line 40 def commands @commands ||= Webpacker::Commands.new self end |
#compiler ⇒ Object
28 29 30 |
# File 'lib/webpacker/instance.rb', line 28 def compiler @compiler ||= Webpacker::Compiler.new self end |
#config ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/webpacker/instance.rb', line 16 def config @config ||= Webpacker::Configuration.new( root_path: root_path, config_path: config_path, env: env ) end |
#dev_server ⇒ Object
32 33 34 |
# File 'lib/webpacker/instance.rb', line 32 def dev_server @dev_server ||= Webpacker::DevServer.new config end |
#env ⇒ Object
12 13 14 |
# File 'lib/webpacker/instance.rb', line 12 def env @env ||= Webpacker::Env.inquire self end |
#inlining_css? ⇒ Boolean
44 45 46 |
# File 'lib/webpacker/instance.rb', line 44 def inlining_css? dev_server.inline_css? && dev_server.hmr? && dev_server.running? end |
#manifest ⇒ Object
36 37 38 |
# File 'lib/webpacker/instance.rb', line 36 def manifest @manifest ||= Webpacker::Manifest.new self end |
#strategy ⇒ Object
24 25 26 |
# File 'lib/webpacker/instance.rb', line 24 def strategy @strategy ||= Webpacker::CompilerStrategy.from_config end |