class WebpackerLite::Configuration

Constants

RAILS_WEB_PUBLIC

Public Class Methods

base_path() click to toggle source
# File lib/webpacker_lite/configuration.rb, line 18
def base_path
  "/#{configuration.fetch(:webpack_public_output_dir, "webpack")}"
end
base_url() click to toggle source

Uses the hot_reloading_host if appropriate

# 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() click to toggle source
# 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() click to toggle source
# File lib/webpacker_lite/configuration.rb, line 46
def file_path
  Rails.root.join("config", "webpacker_lite.yml")
end
manifest_path() click to toggle source
# 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() click to toggle source
# 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

Private Instance Methods

load_data() click to toggle source
Calls superclass method WebpackerLite::FileLoader#load_data
# File lib/webpacker_lite/configuration.rb, line 52
def load_data
  return super unless File.exist?(@path)
  HashWithIndifferentAccess.new(YAML.load(File.read(@path))[WebpackerLite::Env.current])
end