Class: WebpackerLite::Configuration
- Inherits:
-
FileLoader
- Object
- FileLoader
- WebpackerLite::Configuration
- Defined in:
- lib/webpacker_lite/configuration.rb
Constant Summary collapse
- RAILS_WEB_PUBLIC =
"public"
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
18 19 20 |
# File 'lib/webpacker_lite/configuration.rb', line 18 def base_path "/#{configuration.fetch(:webpack_public_output_dir, "webpack")}" end |
.base_url ⇒ Object
Uses the hot_reloading_host if appropriate
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/webpacker_lite/configuration.rb', line 23 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
40 41 42 43 44 |
# File 'lib/webpacker_lite/configuration.rb', line 40 def configuration load_instance raise WebpackerLite::FileLoader::FileLoaderError.new("WebpackerLite::Configuration.load_instance must be called first") unless instance instance.data end |
.file_path ⇒ Object
46 47 48 |
# File 'lib/webpacker_lite/configuration.rb', line 46 def file_path Rails.root.join("config", "webpacker_lite.yml") end |
.manifest_path ⇒ Object
9 10 11 12 |
# File 'lib/webpacker_lite/configuration.rb', line 9 def manifest_path Rails.root.join(webpack_public_output_dir, configuration.fetch(:manifest, "manifest.json")) end |
.webpack_public_output_dir ⇒ Object
14 15 16 |
# File 'lib/webpacker_lite/configuration.rb', line 14 def webpack_public_output_dir Rails.root.join(RAILS_WEB_PUBLIC, configuration.fetch(:webpack_public_output_dir, "webpack")) end |