Hotwire Discussion

Multiple word stimulus controllers in asset pipeline

I have been having trouble writing multiple word controllers ever since using stimulusjs inside of the asset pipeline, I specify in the html like so

and then i write the controller name in the javascripts/controller folder with snake case like this multiple_word_controller.js

this results in the following error Failed to autoload controller: multiple-word
I was writing multiple word controllers before with webpacker but now In not able to.

update
if I name the controller kebab cased it works like multiple-word_controller.js but Im not sure if this is the way its supposed to be written now

Figured this out by reading stimulus controller handbook and says you can specify kebab cased like multiple-word-controller.js, This works great for me in asset pipeline, not sure why snake case doesn’t but this works for me.