Let's you automate registering of new controllers for Stimulus.js by using TypeScript decorator @stimulusController. Good alternative for stimulus-vite-helpers.
- developer can set custom name for the controller
- developer can set custom application for every controller
- by default it uses window.StimulusApplication, also initialises one
- assigns static controllerName attribute on the controller class level
- produces debug logging, so it helps to figure out something
- fully extensible
- copy-paste
stimulus.ts
andlogger.ts
somewhere tolib
folder - use
@stimulusController("<PUT CONTROLLER NAME HERE>")
before class declaration - enjoy automation
DATE: 15.10.2023 AUTHOR: Andrei Makarov (github.com/amkisko)
importmap-rails fully resolves this