diff --git a/bridgetown-core/lib/bridgetown-core/configurations/stimulus.rb b/bridgetown-core/lib/bridgetown-core/configurations/stimulus.rb index 053f73d36..67442628e 100644 --- a/bridgetown-core/lib/bridgetown-core/configurations/stimulus.rb +++ b/bridgetown-core/lib/bridgetown-core/configurations/stimulus.rb @@ -34,9 +34,10 @@ import controllers from "./controllers/**/*.{js,js.rb}" Object.entries(controllers).forEach(([filename, controller]) => { - if (filename.includes("_controller.")) { + if (filename.includes("_controller.") || filename.includes("-controller.")) { const identifier = filename.replace("./controllers/", "") - .replace(/_controller\..*$/, "") + .replace(/[_\-]controller\..*$/, "") + .replace("_", "-") .replace("/", "--") Stimulus.register(identifier, controller.default)