Skip to content

Commit 2317032

Browse files
committed
Key Rewriter
1 parent 61cbf06 commit 2317032

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/faucet_pipeline_rails/manifest.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ class Manifest
55
include Singleton
66

77
def fetch(asset_name)
8-
manifest.fetch(asset_name)
8+
manifest.fetch(key_rewriter[asset_name])
99
rescue KeyError
10-
raise "The asset '#{asset_name}' was not in the manifest"
10+
raise "The asset '#{key_rewriter[asset_name]}' was not in the manifest"
1111
end
1212

1313
private
@@ -32,5 +32,9 @@ def unparsed_manifest
3232
def manifest_path
3333
Rails.configuration.faucet_pipeline.manifest_path
3434
end
35+
36+
def key_rewriter
37+
Rails.configuration.faucet_pipeline.key_rewriter
38+
end
3539
end
3640
end

lib/faucet_pipeline_rails/railtie.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Railtie < Rails::Railtie
2020

2121
initializer "faucet_pipeline.configure_manifest_path" do |app|
2222
app.config.faucet_pipeline.manifest_path ||= app.root.join("public", "assets", "manifest.json")
23+
app.config.faucet_pipeline.key_rewriter ||= ->(key) { key }
2324
end
2425

2526
rake_tasks do

0 commit comments

Comments
 (0)