Skip to content

Commit

Permalink
Initial README
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemanrubia committed Dec 17, 2024
1 parent 034072f commit 19b9cd9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
40 changes: 30 additions & 10 deletions README.md
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).
3 changes: 0 additions & 3 deletions lib/hotwire-spark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ def enabled?
end
end
end



0 comments on commit 19b9cd9

Please sign in to comment.