hotwire-livereload 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +29 -16
- data/lib/hotwire/livereload/engine.rb +15 -12
- data/lib/hotwire/livereload/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6e414e66bbb4fbc76eef6000651aad79952f8f51ea70f19970691c780af09c2
|
4
|
+
data.tar.gz: 76540592b6138efb0365019b43ef04751a7071037f62814babbd05e96ff5bf01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bac450b366a58fe90bdadfdab8898f9592681bc97ff1d1cc2450db0be1fee0f6b32fadce34c5c66fb709266a7283932bee827413b56671ab36b72564238b6447
|
7
|
+
data.tar.gz: acd23ee5a23fce850579b5604ae2d5a2bd4c4d12134bf10bfd0a442a0dcdf96a396aa9bcbdda3aab2953f89d0d7988231cba40ace417c72ce8e37bd79045523a
|
data/README.md
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
# Hotwire::Livereload
|
2
2
|
|
3
|
-
Automatically reload Hotwire Turbo when
|
3
|
+
Automatically reload Hotwire Turbo when app files are modified.
|
4
4
|
|
5
|
-
https://user-images.githubusercontent.com/839922/
|
5
|
+
https://user-images.githubusercontent.com/839922/148676469-0acfa036-832e-4b40-aa05-1fdd945baa1f.mp4
|
6
6
|
|
7
|
-
##
|
8
|
-
|
9
|
-
The JavaScript for Hotwire::Livereload is installed via asset pipeline, which is included with this gem.
|
7
|
+
## Gettings
|
10
8
|
|
11
9
|
Add `hotwire-livereload` to your Gemfile:
|
12
10
|
```
|
@@ -18,9 +16,19 @@ Run installer:
|
|
18
16
|
rails livereload:install
|
19
17
|
```
|
20
18
|
|
19
|
+
Folders listened by default:
|
20
|
+
- `app/views`
|
21
|
+
- `app/helpers`
|
22
|
+
- `app/javascript`
|
23
|
+
- `app/assets/stylesheets`
|
24
|
+
- `app/assets/javascripts`
|
25
|
+
- `app/assets/images`
|
26
|
+
- `app/components`
|
27
|
+
- `config/locales`
|
28
|
+
|
21
29
|
## Configuration
|
22
30
|
|
23
|
-
You can watch for changes in additional folders by adding them to `listen_paths
|
31
|
+
You can watch for changes in additional folders by adding them to `listen_paths`:
|
24
32
|
```ruby
|
25
33
|
# config/environments/development.rb
|
26
34
|
|
@@ -30,22 +38,27 @@ Rails.application.configure do
|
|
30
38
|
end
|
31
39
|
```
|
32
40
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
You can disable default listen paths and fully override them:
|
42
|
+
```ruby
|
43
|
+
# config/environments/development.rb
|
44
|
+
|
45
|
+
Rails.application.configure do
|
46
|
+
# ...
|
47
|
+
config.hotwire_livereload.disable_default_listeners = true
|
48
|
+
config.hotwire_livereload.listen_paths = [
|
49
|
+
Rails.root.join("app/assets/stylesheets"),
|
50
|
+
Rails.root.join("app/javascript")
|
51
|
+
]
|
52
|
+
end
|
53
|
+
```
|
42
54
|
|
43
|
-
|
55
|
+
If you don't have `data-turbo-track="reload"` attribute on your JS and CSS bundles you might need to setup force reloading. This will trigger full browser reloading for JS and CSS files only:
|
44
56
|
```ruby
|
45
57
|
# config/environments/development.rb
|
46
58
|
|
47
59
|
Rails.application.configure do
|
48
60
|
# ...
|
61
|
+
config.hotwire_livereload.force_reload_paths << Rails.root.join("app/assets/stylesheets")
|
49
62
|
config.hotwire_livereload.force_reload_paths << Rails.root.join("app/javascript")
|
50
63
|
end
|
51
64
|
```
|
@@ -9,6 +9,7 @@ module Hotwire
|
|
9
9
|
config.hotwire_livereload = ActiveSupport::OrderedOptions.new
|
10
10
|
config.hotwire_livereload.listen_paths ||= []
|
11
11
|
config.hotwire_livereload.force_reload_paths ||= []
|
12
|
+
config.hotwire_livereload.disable_default_listeners = false
|
12
13
|
config.autoload_once_paths = %W(
|
13
14
|
#{root}/app/channels
|
14
15
|
#{root}/app/helpers
|
@@ -27,19 +28,21 @@ module Hotwire
|
|
27
28
|
end
|
28
29
|
|
29
30
|
initializer "hotwire_livereload.set_configs" do |app|
|
30
|
-
default_listen_paths = %w[
|
31
|
-
app/views
|
32
|
-
app/helpers
|
33
|
-
app/javascript
|
34
|
-
app/assets/stylesheets
|
35
|
-
app/assets/javascripts
|
36
|
-
app/assets/images
|
37
|
-
app/components
|
38
|
-
config/locales
|
39
|
-
].map { |p| Rails.root.join(p) }
|
40
|
-
|
41
31
|
options = app.config.hotwire_livereload
|
42
|
-
|
32
|
+
|
33
|
+
unless options.disable_default_listeners
|
34
|
+
default_listen_paths = %w[
|
35
|
+
app/views
|
36
|
+
app/helpers
|
37
|
+
app/javascript
|
38
|
+
app/assets/stylesheets
|
39
|
+
app/assets/javascripts
|
40
|
+
app/assets/images
|
41
|
+
app/components
|
42
|
+
config/locales
|
43
|
+
].map { |p| Rails.root.join(p) }
|
44
|
+
options.listen_paths += default_listen_paths.select { |p| Dir.exist?(p) }
|
45
|
+
end
|
43
46
|
end
|
44
47
|
|
45
48
|
config.after_initialize do |app|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hotwire-livereload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Platonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|