hotwire-spark 0.1.8 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -10
- data/app/assets/javascripts/hotwire_spark.js +104 -2200
- data/app/assets/javascripts/hotwire_spark.min.js +1 -1
- data/app/assets/javascripts/hotwire_spark.min.js.map +1 -1
- data/app/controllers/hotwire/spark/source_files_controller.rb +14 -0
- data/app/javascript/hotwire/spark/channels/monitoring_channel.js +10 -9
- data/app/javascript/hotwire/spark/index.js +10 -2
- data/app/javascript/hotwire/spark/reloaders/{html_reloader.js → morph_html_reloader.js} +8 -8
- data/app/javascript/hotwire/spark/reloaders/replace_html_reloader.js +31 -0
- data/app/javascript/hotwire/spark/reloaders/stimulus_reloader.js +50 -61
- data/config/routes.rb +1 -0
- data/lib/hotwire/spark/action_cable/server.rb +1 -1
- data/lib/hotwire/spark/default_options.rb +36 -0
- data/lib/hotwire/spark/engine.rb +6 -5
- data/lib/hotwire/spark/file_watcher.rb +5 -1
- data/lib/hotwire/spark/installer.rb +21 -12
- data/lib/hotwire/spark/middleware.rb +12 -7
- data/lib/hotwire/spark/version.rb +1 -1
- data/lib/hotwire-spark.rb +6 -3
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86280ef674a47bc00119c73166435a363c34e6c22804444df25d8f909fe5755c
|
4
|
+
data.tar.gz: 016b6bc8f6bf0f22bf3cec4baa754a167fdc526230f0a57df83c1f0916ee4f56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be78aab02729c9f00b86f366ce7ff2813dab842a2e1b78699d19dfaaf11b61a98e31269cb625939c4a8204fa3c6c3b0f51548098ff4df3cd78d1eee91dfd26b6
|
7
|
+
data.tar.gz: ef71e4ecbb78de1dcfe7b2224e40b7d41455a2da4feb3cbf0967664acd7d8eb8a9e5b3cae7a9fbba48c1647eda661249d7c9866de595e12cc186a4471323eb8c
|
data/README.md
CHANGED
@@ -24,12 +24,25 @@ That's it!
|
|
24
24
|
|
25
25
|
The system will listen for three kinds of changes and will take action depending on each:
|
26
26
|
|
27
|
-
*
|
27
|
+
* HTML contents
|
28
|
+
* CSS
|
29
|
+
* Stimulus controllers
|
30
|
+
|
31
|
+
Depending on your setup, the default behavior will be different.
|
32
|
+
|
33
|
+
### Importmaps
|
34
|
+
|
35
|
+
Importmaps allows for the smoother updates because it supports hot-reloading for Stimulus controllers:
|
36
|
+
|
37
|
+
* **HTML change:** it fetches the new document body and updates the current body with morphing, then it reloads the Stimulus controllers in the page. It uses [`idiomorph`](https://github.com/bigskysoftware/idiomorph) under the hood.
|
28
38
|
* **CSS change:** it fetches and reloads the stylesheet that changed.
|
29
39
|
* **Stimulus controller change:** it fetches the Stimulus controller that changed and reloads all the controllers in the page.
|
30
40
|
|
31
|
-
|
32
|
-
|
41
|
+
### JavaScript Bundling
|
42
|
+
|
43
|
+
* **HTML change:** it reloads the page with a Turbo visit.
|
44
|
+
* **CSS change:** it fetches and reloads the stylesheet that changed.
|
45
|
+
* **Stimulus controller change:** it reloads the page with a Turbo visit.
|
33
46
|
|
34
47
|
## Configuration
|
35
48
|
|
@@ -39,13 +52,17 @@ You can set configuration options on your `development.rb`. For example:
|
|
39
52
|
config.hotwire.spark.html_paths += %w[ lib ]
|
40
53
|
```
|
41
54
|
|
42
|
-
| Name
|
43
|
-
|
44
|
-
| `html_paths`
|
45
|
-
| `css_paths`
|
46
|
-
| `stimulus_paths`
|
47
|
-
| `enabled`
|
48
|
-
| `logging`
|
55
|
+
| Name | Description |
|
56
|
+
|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
57
|
+
| `html_paths` | Paths where file changes trigger a content refresh. By default: `app/controllers`, `app/helpers`, `app/models`, `app/views`. |
|
58
|
+
| `css_paths` | Paths where file changes trigger a CSS refresh. By default: `app/assets/stylesheets` or `app/assets/builds` if exists. |
|
59
|
+
| `stimulus_paths` | Paths where file changes trigger a Stimulus controller refresh. By default: `app/javascript/controllers`. |
|
60
|
+
| `enabled` | Enable or disable live reloading. By default, it's only enabled in `development`. |
|
61
|
+
| `logging` | Show logs in the browser console when reloading happens. It's false by default. |
|
62
|
+
| `html_reload_method` | How to perform reloads when HTML content changes: `:morph` or `:replace`. By default, it is `:morph` and it will morph the `<body>` of the page and reload all the stimulus controllers. Set to `:replace` to reload the page with a regular Turbo navigation that will replace the `<body>`. |
|
63
|
+
| `html_extensions` | The extension to monitor for HTML content changes. By default: `rb`, `erb`. | |
|
64
|
+
| `css_extensions` | The extension to monitor for CSS changes. By default: `css`. | |
|
65
|
+
| `stimulus_extensions` | The extension to monitor for CSS changes. By default: `js`. | |
|
49
66
|
|
50
67
|
## License
|
51
68
|
|