hotwire-spark 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +49 -0
- data/Rakefile +8 -0
- data/app/assets/javascripts/hotwire_spark.js +3705 -0
- data/app/assets/javascripts/hotwire_spark.js.map +1 -0
- data/app/assets/javascripts/hotwire_spark.min.js +2 -0
- data/app/assets/javascripts/hotwire_spark.min.js.map +1 -0
- data/app/assets/stylesheets/hotwire_spark/application.css +15 -0
- data/app/channels/hotwire/spark/channel.rb +5 -0
- data/app/javascript/hotwire/spark/channels/consumer.js +3 -0
- data/app/javascript/hotwire/spark/channels/monitoring_channel.js +47 -0
- data/app/javascript/hotwire/spark/helpers.js +37 -0
- data/app/javascript/hotwire/spark/index.js +14 -0
- data/app/javascript/hotwire/spark/logger.js +8 -0
- data/app/javascript/hotwire/spark/reloaders/css_reloader.js +65 -0
- data/app/javascript/hotwire/spark/reloaders/html_reloader.js +31 -0
- data/app/javascript/hotwire/spark/reloaders/stimulus_reloader.js +76 -0
- data/config/routes.rb +2 -0
- data/lib/hotwire/spark/action_cable/persistent_cable_middleware.rb +43 -0
- data/lib/hotwire/spark/action_cable/persistent_cable_server.rb +25 -0
- data/lib/hotwire/spark/action_cable/solid_cable_listener_with_safe_reloads.rb +8 -0
- data/lib/hotwire/spark/engine.rb +25 -0
- data/lib/hotwire/spark/file_watcher.rb +40 -0
- data/lib/hotwire/spark/installer.rb +52 -0
- data/lib/hotwire/spark/middleware.rb +55 -0
- data/lib/hotwire/spark/version.rb +5 -0
- data/lib/hotwire-spark.rb +26 -0
- data/lib/tasks/hotwire_spark_tasks.rake +4 -0
- metadata +173 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0e93bd38f8ffcf5c1c9dd68472e83e0b6f62697635d3c947ae018f9f8b159a43
|
4
|
+
data.tar.gz: e313fe93960a0e9f29617376e1dd69442c76cac4993ad4c3ad80771b5b0b553d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 144de9a589d7571f0204ec34d48c90c9d771c5d7f986981c2cfe7c57f29f69b38ee74dfe9a6b4355ce487a62a17b17b3e1d37103d162cf6eb08e98a8ee099ee2
|
7
|
+
data.tar.gz: 1d246154fc925e25679a92d5cd1490274aa71fa478c19074b86c2797badd5a9192a197b07d9d487e52d12ca438e66a9ac44fe229955031ac8fbb0a15f5b4eb79
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright Jorge Manrubia
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Hotwire Spark
|
2
|
+
|
3
|
+
**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.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add the gem to the group `development`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
group :development do
|
11
|
+
gem "hotwire-spark"
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$ bundle
|
19
|
+
```
|
20
|
+
|
21
|
+
That's it!
|
22
|
+
|
23
|
+
## Hot it works
|
24
|
+
|
25
|
+
The system will listen for three kinds of changes and will take action depending on each:
|
26
|
+
|
27
|
+
* **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.
|
28
|
+
* **CSS change:** it fetches and reloads the stylesheet that changed.
|
29
|
+
* **Stimulus controller change:** it fetches the Stimulus controller that changed and reloads all the controllers in the page.
|
30
|
+
|
31
|
+
## Configuration
|
32
|
+
|
33
|
+
You can set configuration options on your `development.rb`. For example:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
config.hotwire.spark.html_paths += %w[ lib ]
|
37
|
+
```
|
38
|
+
|
39
|
+
| Name | Description |
|
40
|
+
|------------------|------------------------------------------------------------------------------------------------------------------------------|
|
41
|
+
| `html_paths` | Paths where file changes trigger a content refresh. By default: `app/controllers`, `app/helpers`, `app/models`, `app/views`. |
|
42
|
+
| `css_paths` | Paths where file changes trigger a CSS refresh. By default: `app/assets/stylesheets`. |
|
43
|
+
| `stimulus_paths` | Paths where file changes trigger a Stimulus controller refresh. By default: `app/javascript/controllers`. |
|
44
|
+
| `enabled` | Enable or disable live reloading. By default, it's only enabled in `development`. |
|
45
|
+
| `logging` | Show logs in the browser console when reloading happens. It's false by default. |
|
46
|
+
|
47
|
+
## License
|
48
|
+
|
49
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|