Rails 4.2+ asset-pipeline gem to provide Stimulus.js
- Stimulus 1.1.1
- Stimulus 1.0.1
Have in your Gemfile
:
gem 'stimulusjs-rails', '~> 1.1.1'
And in your application.js
manifest:
//= require stimulus
window.application = Stimulus.Application.start()
Add in your application.js
//= require controllers/hello_controller
and in controllers/hello_controller.es6
window.application.register('hello', class extends Stimulus.Controller {
static get targets() {
return [ "name" ]
}
// …
})
See this for Sprocket + ES6 support: https://github.com/rails/sprockets#es6-support
Contributions are welcome, please follow GitHub Flow