vite_rails 1.0.6 โ†’ 1.0.7

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: e6696b0e5605b6b818d3512247732ca61379c1c54ffd2da4d4fba9aa45b0fb9e
4
- data.tar.gz: 679a936095a88dfbc9a03b3bf0fe04003ebde7aad4d4cf1b65bd2dcf23c2fd22
3
+ metadata.gz: 7f4c178774d28f47732953d6d672db2b2551030534b7a607f157e4692e992160
4
+ data.tar.gz: 9cb4eeab752ca23b2857487b1217d7e3f5b73afa72663ea8e01372328129368f
5
5
  SHA512:
6
- metadata.gz: 4bf20acab3ed24be1785dcf2663d037ac4e026d1c73fb8a9b74b2487cda253a9e22b3e352930415296b1f746c9b777adfc664c2993664cfb2cb908e1b8850d1e
7
- data.tar.gz: 44a029814b091587cd2d50589276cd1c757c18302e0155878c88c0e5cd0005353e24b32bc6c74205a0752291c5c24e51182b259e22f97c69ba16d713ebafbbe1
6
+ metadata.gz: 99ce8a2425f5eeaac8715f6204ec19b80d7b215dfe427cd765f25023c0fb82e72b086cf883e0e36931b4ae8f70457910fd57d21a59258befe139456e89bb130e
7
+ data.tar.gz: e693145af6596c602eac3136ada51393bf2dd9e06d5d8372739dbef84d811cc8bc3e689411ba308f8535bbeafa0356e8f26452342d2bba9a05132fd839588623
@@ -1,3 +1,7 @@
1
+ ## Vite Rails 1.0.7 (2020-01-20)
2
+
3
+ - Add `vite_client_tag` to ensure the Vite client can be loaded in apps that don't use any imports.
4
+
1
5
  ## Vite Rails 1.0.6 (2020-01-20)
2
6
 
3
7
  - Ensure running `bin/rake assets:precompile` automatically invokes `vite:build`.
data/README.md CHANGED
@@ -19,26 +19,30 @@
19
19
  </p>
20
20
  </h1>
21
21
 
22
+ [website]: https://vite-rails.netlify.app/
23
+ [features]: https://vite-rails.netlify.app/guide/introduction.html
24
+ [guides]: https://vite-rails.netlify.app/guide/
25
+ [config]: https://vite-rails.netlify.app/config/
22
26
  [vite_rails]: https://github.com/ElMassimo/vite_rails
23
27
  [webpacker]: https://github.com/rails/webpacker
24
28
  [vite]: http://vitejs.dev/
25
29
  [config file]: https://github.com/ElMassimo/vite_rails/blob/main/package/default.vite.json
26
30
 
27
- [__Vite Rails__][vite_rails] allows you to use [Vite] to power the frontend.
31
+ [__Vite Rails__][vite_rails] allows you to use [Vite] to power the frontend of your Rails app.
28
32
 
29
33
  [Vite] is to frontend tooling as Ruby to programming, pure joy! ๐Ÿ˜
30
34
 
31
35
  ## Features โšก๏ธ
32
36
 
33
- - ๐Ÿค– Automatic Entrypoint Detection
34
- - โšก๏ธ Hot Reload
35
- - โš™๏ธ Rake Tasks
36
- - ๐Ÿค Integrated with <kbd>assets:precompile</kbd> and friends
37
- - And more! (detects changes, and builds automatically if Vite is not running)
37
+ - ๐Ÿค– Automatic entrypoint detection
38
+ - โšก๏ธ Blazing fast hot reload
39
+ - ๐Ÿš€ Zero-config deployments
40
+ - ๐Ÿค Integrated with <kbd>assets:precompile</kbd>
41
+ - [And more!][features]
38
42
 
39
43
  ## Documentation ๐Ÿ“–
40
44
 
41
- A documentation website is coming soon!
45
+ Visit the [documentation website][website] to check out the [guides] and searchable [configuration reference].
42
46
 
43
47
  ## Installation ๐Ÿ’ฟ
44
48
 
@@ -57,70 +61,22 @@ bin/rake vite:install
57
61
 
58
62
  This will generate configuration files and a sample setup.
59
63
 
60
- ## Usage ๐Ÿš€
64
+ Additional installation instructions are available in the [documentation website][website].
61
65
 
62
- Drawing inspiration from [webpacker], any files in `app/javascript/entrypoints`
63
- will be considered entries to your application (SPAs or pages).
66
+ ## Getting Started ๐Ÿ’ป
64
67
 
65
- These files will be detected, and passed on to Vite, all configuration is done
66
- for you.
68
+ Restart your Rails server, and then run `bin/vite` to start the Vite development server.
67
69
 
68
- ### Imports โคต๏ธ
70
+ Add the following your `views/layouts/application.html.erb`:
69
71
 
70
- For convenience, a `~/` import alias is configured to `app/javascript`, allowing
71
- you to use absolute paths:
72
-
73
- ```js
74
- import { createApp } from 'vue'
75
- import App from '~/App.vue'
76
- import '~/channels'
77
-
78
- createApp(App).mount('#app')
72
+ ```erb
73
+ <%= vite_client_tag %>
74
+ <%= vite_javascript_tag 'application' %>
79
75
  ```
80
76
 
81
- ### Tags ๐Ÿท
82
-
83
- `vite_typescript_tag`, `vite_javascript_tag`, and `vite_stylesheet_tag` can be
84
- used to output `<script>` and `<link>` tags in your Rails layouts or templates.
85
-
86
- ```html
87
- <head>
88
- <title>Joie</title>
89
- <%= csrf_meta_tags %>
90
- <%= csp_meta_tag %>
91
-
92
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
93
- <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
94
-
95
- <%= vite_stylesheet_tag 'strange' %>
96
- <%= vite_typescript_tag 'application' %>
97
- </head>
98
- ```
99
-
100
- For other types of assets, you can use `vite_asset_path` and pass that to the appropriate tag helper.
101
-
102
- ## Configuration โš™๏ธ
103
-
104
- This is what your `config/vite.json` might look like:
105
-
106
- ```json
107
- {
108
- "all": {
109
- "watchAdditionalPaths": []
110
- },
111
- "development": {
112
- "autoBuild": true,
113
- "publicOutputDir": "vite-dev",
114
- "port": 3036
115
- },
116
- "test": {
117
- "autoBuild": true,
118
- "publicOutputDir": "vite-test"
119
- }
120
- }
121
- ```
77
+ Visit any page and you should see a printed console output: `Vite โšก๏ธ Rails`.
122
78
 
123
- Check [this file][config file] to see all config options, documentation is coming soon.
79
+ For more [guides] and a full [configuration reference], check the [documentation website][website].
124
80
 
125
81
  ## Inspiration ๐Ÿ’ก
126
82
 
@@ -9,6 +9,11 @@ module ViteRails::Helper
9
9
  ViteRails.instance
10
10
  end
11
11
 
12
+ # Public: Renders a script tag for vite/client to enable HMR in development.
13
+ def vite_client_tag
14
+ content_tag('script', '', src: '/@vite/client', type: 'module') if ViteRails.dev_server_running?
15
+ end
16
+
12
17
  # Public: Computes the relative path for the specified given Vite asset.
13
18
  #
14
19
  # Example:
@@ -28,12 +33,12 @@ module ViteRails::Helper
28
33
  js_entries = names.map { |name| current_vite_instance.manifest.lookup!(name, type: asset_type) }
29
34
  js_tags = javascript_include_tag(*js_entries.map { |entry| entry['file'] }, type: type, crossorigin: crossorigin, **options)
30
35
 
31
- unless skip_preload_tags || ViteRails.dev_server.running?
36
+ unless skip_preload_tags || ViteRails.dev_server_running?
32
37
  preload_paths = js_entries.flat_map { |entry| entry['imports'] }.compact.uniq
33
38
  preload_tags = preload_paths.map { |path| preload_link_tag(path, crossorigin: crossorigin) }
34
39
  end
35
40
 
36
- unless skip_style_tags || ViteRails.dev_server.running?
41
+ unless skip_style_tags || ViteRails.dev_server_running?
37
42
  style_paths = names.map { |name| current_vite_instance.manifest.lookup(name, type: :stylesheet)&.fetch('file') }.compact
38
43
  style_tags = stylesheet_link_tag(*style_paths)
39
44
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViteRails
4
- VERSION = '1.0.6'
4
+ VERSION = '1.0.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vite_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mรกximo Mussini
@@ -186,8 +186,8 @@ homepage: https://github.com/ElMassimo/vite_rails
186
186
  licenses:
187
187
  - MIT
188
188
  metadata:
189
- source_code_uri: https://github.com/ElMassimo/vite_rails/tree/v1.0.6
190
- changelog_uri: https://github.com/ElMassimo/vite_rails/blob/v1.0.6/CHANGELOG.md
189
+ source_code_uri: https://github.com/ElMassimo/vite_rails/tree/v1.0.7
190
+ changelog_uri: https://github.com/ElMassimo/vite_rails/blob/v1.0.7/CHANGELOG.md
191
191
  post_install_message:
192
192
  rdoc_options: []
193
193
  require_paths: