Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laravel-frontend-presets/stimulus
Laravel 5.5+ frontend preset for Stimulus
https://github.com/laravel-frontend-presets/stimulus
laravel preset stimulus
Last synced: 3 months ago
JSON representation
Laravel 5.5+ frontend preset for Stimulus
- Host: GitHub
- URL: https://github.com/laravel-frontend-presets/stimulus
- Owner: laravel-frontend-presets
- License: mit
- Created: 2018-11-01T07:40:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-02T23:18:57.000Z (over 6 years ago)
- Last Synced: 2024-07-30T20:43:46.388Z (6 months ago)
- Topics: laravel, preset, stimulus
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 10
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel 5.5+ frontend preset for Stimulus
This package makes it easy to use [Stimulus](https://stimulusjs.org/), a modest JavaScript framework for the HTML you already have, with Laravel 5.5+.
Read more on [the origin of Stimulus](https://stimulusjs.org/handbook/origin).
## Contents
- [Installation/Usage](#installation-usage)
- [Options](#options)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)## Installation/Usage
To install this preset on your Laravel application, simply run:
```bash
composer require laravel-frontend-presets/stimulus
php artisan preset stimulus
npm install # or yarn install
npm run dev # or yarn dev
```This will:
- Add the Stimulus preset package
- Remove JavaScript files other than `bootstrap.js`
- Add JavaScript files for leveraging Stimulus
- Install Node.js dependencies
- Build frontend assetsOnce complete, ensure that the built `js/app.js` file in your `public` directory is loaded in a Blade layout or view, e.g.:
```html
```
The Stimulus controllers defined in `resources/assets/js/controllers` (or `resources/js/controllers` for Laravel 5.7+) will be available at runtime.
> **Note:** After updating your defined Stimulus controllers, remember to rebuild your frontend assets to reflect your changes.
Your Stimulus controllers will be included in your project automatically via Webpack's `require.context` feature and a Stimulus helper. If you're not using Laravel Mix or other Webpack-based build tools, review the Stimulus Handbook for [alternative integration steps](https://stimulusjs.org/handbook/installing).
Stimulus operates based on HTML data attributes, so update your view(s) to make use of your defined Stimulus controllers. For the default `hello-controller`, the necessary HTML would look similar to:
```html
Greet
```Learn more about Stimulus by reading the [handbook](https://stimulusjs.org/handbook/introduction) and/or [reference](https://stimulusjs.org/reference/controllers).
## Options
- `with-turbolinks` - Adds [Turbolinks](https://github.com/turbolinks/turbolinks) to make navigating your web application faster.
Example:
```bash
php artisan preset stimulus --option=with-turbolinks
```## Contributing
Please check our contributing rules in [our website](https://laravel-frontend-presets.github.io) for details.
## Credits
- [Shane Logsdon](https://github.com/slogsdon)
- [All Contributors](../../contributors)## License
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.