1414[ sourceCodeDir ] : /config/#sourcecodedir
1515[ autoBuild ] : /config/#autobuild
1616[ entrypoints ] : /guide/development.html#entrypoints-⤵%EF%B8%8F
17- [ vite_client_tag ] : https://github.com/ElMassimo/vite_ruby/blob/main/vite_rails/lib/vite_rails/tag_helpers.rb
18- [ vite_javascript_tag ] : https://github.com/ElMassimo/vite_ruby/blob/main/vite_rails/lib/vite_rails/tag_helpers.rb
19- [ vite_typescript_tag ] : https://github.com/ElMassimo/vite_ruby/blob/main/vite_rails/lib/vite_rails/tag_helpers.rb
20- [ vite_stylesheet_tag ] : https://github.com/ElMassimo/vite_ruby/blob/main/vite_rails/lib/vite_rails/tag_helpers.rb
21- [ vite_asset_path ] : https://github.com/ElMassimo/vite_ruby/blob/main/vite_rails/lib/vite_rails/tag_helpers.rb
17+ [ helpers ] : https://github.com/ElMassimo/vite_ruby/blob/main/vite_rails/lib/vite_rails/tag_helpers.rb
2218[ development ] : /guide/development
2319[ vite_rails ] : https://github.com/ElMassimo/vite_ruby/tree/main/vite_rails
2420[ installed example ] : https://github.com/ElMassimo/vite_ruby/tree/main/examples/rails
@@ -40,10 +36,9 @@ As we saw in the [development] section, [entrypoints] will be [automatically det
4036In order to link the JavaScript and CSS managed by Vite in your Rails layouts or
4137templates, you can using the following helpers:
4238
43- - <kbd >[ vite_client_tag] </kbd >: Renders the Vite client to enable Hot Module Reload.
44- - <kbd >[ vite_javascript_tag] </kbd >: Render a ` <script> ` tag referencing a JavaScript file.
45- - <kbd >[ vite_typescript_tag] </kbd >: Render a ` <script> ` tag referencing a TypeScript file.
46- - <kbd >[ vite_stylesheet_tag] </kbd >: Render a ` <link> ` tag referencing a CSS file.
39+ - <kbd >[ vite_javascript_tag] [ helpers ] </kbd >: Renders a ` <script> ` tag referencing a JavaScript file
40+ - <kbd >[ vite_typescript_tag] [ helpers ] </kbd >: Renders a ` <script> ` tag referencing a TypeScript file
41+ - <kbd >[ vite_stylesheet_tag] [ helpers ] </kbd >: Renders a ` <link> ` tag referencing a CSS file
4742
4843You can pass any options supported by <kbd >javascript_include_tag</kbd > and <kbd >stylesheet_link_tag</kbd >.
4944
@@ -59,7 +54,7 @@ You can pass any options supported by <kbd>javascript_include_tag</kbd> and <kbd
5954</head>
6055```
6156
62- For other types of assets, you can use <kbd >[ vite_asset_path] </kbd > and pass the resulting URI to the appropriate tag helper.
57+ For other types of assets, you can use <kbd >[ vite_asset_path] [ helpers ] </kbd > and pass the resulting URI to the appropriate tag helper.
6358
6459``` erb
6560<img src="<%= vite_asset_path 'images/logo.svg' %>" />
@@ -72,9 +67,26 @@ If using `.jsx`, `.tsx`, or any other extension, make sure to be explicit:
7267<%= vite_javascript_tag 'application.tsx' %>
7368```
7469
70+ ### Enabling Hot Module Reload 🔥
71+
72+ Use the following helpers to enable HMR in development:
73+
74+ - <kbd >[ vite_client_tag] [ helpers ] </kbd >: Renders the Vite client to enable Hot Module Reload
75+ - <kbd >[ vite_react_refresh_tag] [ helpers ] </kbd >: Only when using ` @vitejs/plugin-react-refresh `
76+
77+ They will only render if the dev server is running.
78+
79+ #### Hot Reload for Stimulus Controllers
80+
81+ If you are using [ Stimulus] , check out <kbd >[ vite-plugin-stimulus-hmr] </kbd >.
82+
83+ You will no longer need to refresh the page when tweaking your controllers 😃
84+
85+ Comes installed by default in [ this template] [ jumpstart ] .
86+
7587### Smart Output ✨
7688
77- For convenience, <kbd >[ vite_javascript_tag] </kbd > will automatically inject tags for styles or entries imported within a script.
89+ For convenience, <kbd >[ vite_javascript_tag] [ helpers ] </kbd > will automatically inject tags for styles or entries imported within a script.
7890
7991``` erb
8092<%= vite_javascript_tag 'application' %>
@@ -93,11 +105,3 @@ When running the development server, these tags are omitted, as Vite will load t
93105``` erb
94106<script src="/vite/assets/application.js" type="module" crossorigin="anonymous"/>
95107```
96-
97- ### Stimulus HMR 🔥
98-
99- If you are using [ Stimulus] , check out <kbd >[ vite-plugin-stimulus-hmr] </kbd >, which provides HMR for Stimulus controllers.
100-
101- You will no longer need to refresh the page when tweaking your controllers 😃
102-
103- Comes installed by default in [ this template] [ jumpstart ] .
0 commit comments