Class: WebpackerLite::Configuration
- Inherits:
-
FileLoader
- Object
- FileLoader
- WebpackerLite::Configuration
- Defined in:
- lib/webpacker_lite/configuration.rb
Instance Attribute Summary
Attributes inherited from FileLoader
Class Method Summary collapse
- .base_path ⇒ Object
-
.base_url ⇒ Object
Uses the hot_reloading_host if appropriate.
- .configuration ⇒ Object
- .file_path ⇒ Object
- .manifest_path ⇒ Object
- .webpack_public_output_dir ⇒ Object
Methods inherited from FileLoader
Class Method Details
.base_path ⇒ Object
17 18 19 |
# File 'lib/webpacker_lite/configuration.rb', line 17 def base_path "/#{configuration.fetch(:webpack_public_output_dir, "webpack")}" end |
.base_url ⇒ Object
Uses the hot_reloading_host if appropriate
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/webpacker_lite/configuration.rb', line 22 def base_url if WebpackerLite::Env.hot_loading? host = configuration[:hot_reloading_host] if host.blank? raise "WebpackerLite's /config/webpacker_lite.yml needs a configuration value for the "\ "`hot_reloading_host` for environment #{Rails.env}." end if host.starts_with?("http") host else "http://#{host}" end else base_path end end |
.configuration ⇒ Object
39 40 41 42 43 |
# File 'lib/webpacker_lite/configuration.rb', line 39 def configuration load if WebpackerLite::Env.development? raise WebpackerLite::FileLoader::FileLoaderError.new("WebpackerLite::Configuration.load must be called first") unless instance instance.data end |
.file_path ⇒ Object
45 46 47 |
# File 'lib/webpacker_lite/configuration.rb', line 45 def file_path Rails.root.join("config", "webpacker_lite.yml") end |
.manifest_path ⇒ Object
7 8 9 10 |
# File 'lib/webpacker_lite/configuration.rb', line 7 def manifest_path Rails.root.join(webpack_public_output_dir, configuration.fetch(:manifest, "manifest.json")) end |
.webpack_public_output_dir ⇒ Object
12 13 14 15 |
# File 'lib/webpacker_lite/configuration.rb', line 12 def webpack_public_output_dir Rails.root.join( File.join("public", configuration.fetch(:webpack_public_output_dir, "webpack"))) end |