Class: Shakapacker::Instance
- Inherits:
-
Object
- Object
- Shakapacker::Instance
- Defined in:
- lib/shakapacker/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/shakapacker.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/shakapacker.yml")) ⇒ Instance
Returns a new instance of Instance.
8 9 10 11 12 13 |
# File 'lib/shakapacker/instance.rb', line 8 def initialize(root_path: Rails.root, config_path: Rails.root.join("config/shakapacker.yml")) @root_path = root_path # For backward compatibility @config_path = Shakapacker.get_config_file_path_with_backward_compatibility(config_path) end |
Instance Attribute Details
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
6 7 8 |
# File 'lib/shakapacker/instance.rb', line 6 def config_path @config_path end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
6 7 8 |
# File 'lib/shakapacker/instance.rb', line 6 def root_path @root_path end |
Instance Method Details
#commands ⇒ Object
43 44 45 |
# File 'lib/shakapacker/instance.rb', line 43 def commands @commands ||= Shakapacker::Commands.new self end |
#compiler ⇒ Object
31 32 33 |
# File 'lib/shakapacker/instance.rb', line 31 def compiler @compiler ||= Shakapacker::Compiler.new self end |
#config ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/shakapacker/instance.rb', line 19 def config @config ||= Shakapacker::Configuration.new( root_path: root_path, config_path: config_path, env: env ) end |
#dev_server ⇒ Object
35 36 37 |
# File 'lib/shakapacker/instance.rb', line 35 def dev_server @dev_server ||= Shakapacker::DevServer.new config end |
#env ⇒ Object
15 16 17 |
# File 'lib/shakapacker/instance.rb', line 15 def env @env ||= Shakapacker::Env.inquire self end |
#inlining_css? ⇒ Boolean
47 48 49 |
# File 'lib/shakapacker/instance.rb', line 47 def inlining_css? dev_server.inline_css? && dev_server.hmr? && dev_server.running? end |
#manifest ⇒ Object
39 40 41 |
# File 'lib/shakapacker/instance.rb', line 39 def manifest @manifest ||= Shakapacker::Manifest.new self end |
#strategy ⇒ Object
27 28 29 |
# File 'lib/shakapacker/instance.rb', line 27 def strategy @strategy ||= Shakapacker::CompilerStrategy.from_config end |