class WebpackerLite::Manifest
Public Class Methods
exist?()
click to toggle source
Helper method to determine if the manifest file exists.
# File lib/webpacker_lite/manifest.rb, line 15 def exist? path_object = WebpackerLite::Configuration.manifest_path path_object.exist? end
file_path()
click to toggle source
# File lib/webpacker_lite/manifest.rb, line 20 def file_path WebpackerLite::Configuration.manifest_path end
lookup(name)
click to toggle source
Find the real file name from the manifest key.
# File lib/webpacker_lite/manifest.rb, line 41 def lookup(name) instance.confirm_manifest_exists load_instance raise WebpackerLite::FileLoader::FileLoaderError.new("WebpackerLite::Manifest.load must be called first") unless instance instance.data[name.to_s] end
lookup!(name)
click to toggle source
Same as lookup, but raises an error.
# File lib/webpacker_lite/manifest.rb, line 36 def lookup!(name) lookup(name) || missing_file_from_manifest_error(name) end
missing_file_from_manifest_error(bundle_name)
click to toggle source
# File lib/webpacker_lite/manifest.rb, line 24 def missing_file_from_manifest_error(bundle_name) msg = <<-MSG WebpackerLite can't find #{bundle_name} in your manifest #{file_path}. Possible causes: 1. You are hot reloading. 2. Webpack has not re-run to reflect updates. 3. You have misconfigured WebpackerLite's config/webpacker_lite.yml file. 4. Your Webpack configuration is not creating a manifest. MSG raise(WebpackerLite::FileLoader::NotFoundError.new(msg)) end
Public Instance Methods
confirm_manifest_exists()
click to toggle source
# File lib/webpacker_lite/manifest.rb, line 50 def confirm_manifest_exists raise missing_manifest_file_error(@path) unless File.exist?(@path) end
Private Instance Methods
load_data()
click to toggle source
Calls superclass method
WebpackerLite::FileLoader#load_data
# File lib/webpacker_lite/manifest.rb, line 68 def load_data return super unless File.exist?(@path) JSON.parse(File.read(@path)) end
missing_manifest_file_error(path_object)
click to toggle source
# File lib/webpacker_lite/manifest.rb, line 56 def missing_manifest_file_error(path_object) msg = <<-MSG WebpackerLite can't find the manifest file: #{path_object} Possible causes: 1. You have not invoked webpack. 2. You have misconfigured WebpackerLite's config/webpacker_lite.yml file. 3. Your Webpack configuration is not creating a manifest. MSG raise(WebpackerLite::FileLoader::NotFoundError.new(msg)) end