Sha256: 9bba821572356b091907a4521b31ef701cdba5a948a7c1e25a936029848b0178
Contents?: true
Size: 518 Bytes
Versions: 6
Compression:
Stored size: 518 Bytes
Contents
# ref. https://qiita.com/Tak-Iwamoto/items/efce14f67eb572d8742e module Resizing::Rails::WebpackBundleHelper class BundleNotFound < StandardError; end def asset_bundle_path(file) valid_file?(file) return "/assets" + manifest.fetch(file) end private def manifest return @manifest ||= JSON.parse(File.read("app/javascript/dist/manifest.json")) end def valid_file?(entry) return true if manifest.key?(entry) raise BundleNotFound, "Could not find bundle with name #{entry}" end end
Version data entries
6 entries across 6 versions & 1 rubygems