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 |
# 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 @config_path = Pathname.new(ENV["SHAKAPACKER_CONFIG"] || 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
41 42 43 |
# File 'lib/shakapacker/instance.rb', line 41 def commands @commands ||= Shakapacker::Commands.new self end |
#compiler ⇒ Object
29 30 31 |
# File 'lib/shakapacker/instance.rb', line 29 def compiler @compiler ||= Shakapacker::Compiler.new self end |
#config ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/shakapacker/instance.rb', line 17 def config @config ||= Shakapacker::Configuration.new( root_path: root_path, config_path: config_path, env: env ) end |
#dev_server ⇒ Object
33 34 35 |
# File 'lib/shakapacker/instance.rb', line 33 def dev_server @dev_server ||= Shakapacker::DevServer.new config end |
#env ⇒ Object
13 14 15 |
# File 'lib/shakapacker/instance.rb', line 13 def env @env ||= Shakapacker::Env.inquire self end |
#inlining_css? ⇒ Boolean
45 46 47 |
# File 'lib/shakapacker/instance.rb', line 45 def inlining_css? dev_server.inline_css? && dev_server.hmr? && dev_server.running? end |
#manifest ⇒ Object
37 38 39 |
# File 'lib/shakapacker/instance.rb', line 37 def manifest @manifest ||= Shakapacker::Manifest.new self end |
#strategy ⇒ Object
25 26 27 |
# File 'lib/shakapacker/instance.rb', line 25 def strategy @strategy ||= Shakapacker::CompilerStrategy.from_config end |