-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
034072f
commit 19b9cd9
Showing
2 changed files
with
30 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,48 @@ | ||
# Hotwire Spark | ||
Short description and motivation. | ||
|
||
## Usage | ||
How to use my plugin. | ||
**Hotwire Spark** is a live-reloading system for Hotwire applications. It enhances your development feedback loop by detecting source code changes and updating the page *smoothly* without requiring a manual reload. | ||
|
||
## Installation | ||
Add this line to your application's Gemfile: | ||
|
||
Add the gem to the group `development`: | ||
|
||
```ruby | ||
gem "hotwire_spark" | ||
group :development do | ||
gem "hotwire_spark" | ||
end | ||
``` | ||
|
||
And then execute: | ||
|
||
```bash | ||
$ bundle | ||
``` | ||
|
||
Or install it yourself as: | ||
```bash | ||
$ gem install hotwire_spark | ||
That's it! | ||
|
||
## Hot it works | ||
|
||
The system will listen for three kinds of changes and will take action depending on each: | ||
|
||
* HTML change: it fetches the new document body and updates the current body with morphing. It uses [`idiomorph`](https://github.com/bigskysoftware/idiomorph) under the hood. | ||
* CSS change: it fetches and reload the stylesheet that changed. | ||
* Stimulus controller change: it fetches the Stimulus controller that changed and reload all the controllers in the page. | ||
|
||
## Configuration | ||
|
||
You can set configuration options on your `development.rb`. For example: | ||
|
||
```ruby | ||
config.hotwire.spark.html_paths += %w[ lib ] | ||
``` | ||
|
||
## Contributing | ||
Contribution directions go here. | ||
| Name | Description | | ||
|------------------|------------------------------------------------------------------------------------------------------------------------------| | ||
| `enabled` | Enable or disable live reloading. By default, it's only enabled in `development`. | | ||
| `html_paths` | Paths where file changes trigger a content refresh. By default: `app/controllers`, `app/helpers`, `app/models`, `app/views`. | | ||
| `css_paths` | Paths where file changes trigger a CSS refresh. By default: `app/assets/stylesheets`. | | ||
| `stimulus_paths` | Paths where file changes trigger a Stimulus controller refresh. By default: `app/javascript/controllers`. | | ||
|
||
## License | ||
|
||
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,3 @@ def enabled? | |
end | ||
end | ||
end | ||
|
||
|
||
|