Skip to content

Commit ed261bb

Browse files
author
Takashi Kato
committed
Add cache_sweeper paths
1 parent 6a877c7 commit ed261bb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/importmap_mocha/engine.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ class Engine < ::Rails::Engine
3030
app.config.importmap.paths << Engine.root.join('config/importmap.rb') if Rails.application.respond_to?(:importmap)
3131
end
3232

33+
initializer "importmap_mocha.cache_sweeper", before: "importmap.cache_sweeper" do |app|
34+
if app.config.importmap.sweep_cache && !app.config.cache_classes
35+
app.config.importmap.cache_sweepers << Engine.root.join('app/assets/javascripts')
36+
app.config.importmap.cache_sweepers << Engine.root.join('vendor/javascripts')
37+
app.config.importmap.cache_sweepers += Rails.application.config.importmap_mocha_path
38+
end
39+
end
40+
41+
3342
initializer 'importmap_mocha.routes' do
3443
Rails.application.routes.prepend do
3544
scope module: 'importmap_mocha' do

0 commit comments

Comments
 (0)