Seamless integration of stimulus.cr into crumble, providing a JS module that automatically includes all your Stimulus::Controller
s and can be easily added to your template.
-
Add the dependency to your
shard.yml
:dependencies: crumble-stimulus: github: sbsoftware/crumble-stimulus
-
Run
shards install
# or wherever your Stimulus controllers are
require "./stimulus_controllers/*"
# make sure this comes after you required all controllers you want to include, otherwise they'll be missing
require "crumble-stimulus"
In your template:
html do
head do
# [...]
script Crumble::StimulusControllers
# [...]
end
end
And that's it!