hotwire-livereload 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2634bec56254429d0d3f222fdc56d3e6acae483e8158da3c8314540c812da537
4
- data.tar.gz: 0162d148937597fb06a5f6f23ba43dedabe550cde88e892dbc2369ce63e6fd4f
3
+ metadata.gz: b6e414e66bbb4fbc76eef6000651aad79952f8f51ea70f19970691c780af09c2
4
+ data.tar.gz: 76540592b6138efb0365019b43ef04751a7071037f62814babbd05e96ff5bf01
5
5
  SHA512:
6
- metadata.gz: 946841da42fc46ab057128a32881e72a2d35dc69759e6036cf562b58d70db8d793a0d338312623c665afcf5c3edf4e4a54e3b573528b139e6a20af2bb1bb24c2
7
- data.tar.gz: ec6af99da8e71eadae77b68e579a65ccab81ad3acb9bd54f70466908cdc14f67ece5667e7bc31f7a4f44f52e0d449a22961a3729c2a098189ca30ec84c24c09e
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 "view" files are modified.
3
+ Automatically reload Hotwire Turbo when app files are modified.
4
4
 
5
- https://user-images.githubusercontent.com/839922/131983979-afd0bcc7-86e8-4c53-9758-3bf762dbb16a.mp4
5
+ https://user-images.githubusercontent.com/839922/148676469-0acfa036-832e-4b40-aa05-1fdd945baa1f.mp4
6
6
 
7
- ## Installation
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`. For example, you can watch for CSS changes:
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
- Folders listened by default:
34
- - `app/views`
35
- - `app/helpers`
36
- - `app/javascript`
37
- - `app/assets/stylesheets`
38
- - `app/assets/javascripts`
39
- - `app/assets/images`
40
- - `app/components`
41
- - `config/locales`
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
- You can setup force reloading (full page reload) for changes in some folders using `force_reload_paths` option. For example, you can trigger force reload on JS changes:
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
- options.listen_paths += default_listen_paths.select { |p| Dir.exist?(p) }
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|
@@ -1,5 +1,5 @@
1
1
  module Hotwire
2
2
  module Livereload
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
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.0.0
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: 2021-12-31 00:00:00.000000000 Z
11
+ date: 2022-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails