Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hotwired/stimulus-webpack-helpers
Webpack helpers for @hotwired/stimulus.
https://github.com/hotwired/stimulus-webpack-helpers
stimulusjs webpack
Last synced: 3 months ago
JSON representation
Webpack helpers for @hotwired/stimulus.
- Host: GitHub
- URL: https://github.com/hotwired/stimulus-webpack-helpers
- Owner: hotwired
- License: mit
- Created: 2021-09-13T11:14:36.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-03-14T07:47:42.000Z (8 months ago)
- Last Synced: 2024-05-11T21:02:43.313Z (6 months ago)
- Topics: stimulusjs, webpack
- Language: TypeScript
- Homepage: https://stimulus.hotwired.dev/
- Size: 31.3 KB
- Stars: 35
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Stimulus Webpack Helpers
## Using Stimulus Webpack Helpers
Call webpack's [`require.context`](https://webpack.js.org/api/module-methods/#requirecontext) helper with the path to the folder containing your Stimulus controllers. Then, pass the resulting context to the `Application#load` method using the `definitionsFromContext` helper:
```js
// src/application.js
import { Application } from "@hotwired/stimulus"
import { definitionsFromContext } from "@hotwired/stimulus-webpack-helpers"const application = Application.start()
const context = require.context("./controllers", true, /\.js$/)
application.load(definitionsFromContext(context))
window.Stimulus = application
```## Getting Help & Contributing Back
Looking for the docs? Once you've read through the Handbook, consult the [Stimulus Reference](https://stimulus.hotwired.dev/reference/controllers) for API details.
Have a question about Stimulus? Connect with other Stimulus developers on the [Hotwire Discourse](https://discuss.hotwired.dev/) community forum.
Find a bug? Head over to our [issue tracker](https://github.com/hotwired/stimulus-webpack-helpers/issues) and we'll do our best to help. We love pull requests, too!
We expect all Stimulus contributors to abide by the terms of our [Code of Conduct](CODE_OF_CONDUCT.md).
## Acknowledgments
Stimulus is [MIT-licensed](LICENSE.md) open-source software from [Basecamp](https://basecamp.com/), the creators of [Ruby on Rails](http://rubyonrails.org).
Continuous integration VMs generously provided by [Sauce Labs](https://saucelabs.com/open-source).
---
© 2021 Basecamp, LLC.