You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to automatically generate and maintain `routes.js` file and corresponding
@@ -75,7 +77,9 @@ Add js-routes files to `.gitignore`:
75
77
/app/javascript/routes.d.ts
76
78
```
77
79
78
-
### Webpacker ERB loader {#webpack}
80
+
<divid="webpack"></div>
81
+
82
+
### Webpacker ERB loader
79
83
80
84
**IMPORTANT**: the setup doesn't support IDE autocompletion with [Typescript](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html)
81
85
@@ -136,7 +140,9 @@ import {post_path} from 'routes.js.erb';
136
140
alert(post_path(2));
137
141
```
138
142
139
-
### Advanced Setup {#advanced-setup}
143
+
<divid="advanced-setup"></div>
144
+
145
+
### Advanced Setup
140
146
141
147
In case you need multiple route files for different parts of your application, there are low level methods:
142
148
@@ -201,7 +207,9 @@ class AdvancedJsRoutesMiddleware < JsRoutes::Middleware
201
207
end
202
208
```
203
209
204
-
#### Typescript Definitions {#definitions}
210
+
<divid="definitions"></div>
211
+
212
+
#### Typescript Definitions
205
213
206
214
JsRoutes has typescript support out of the box.
207
215
@@ -222,7 +230,9 @@ JsRoutes.definitions # to output to string
222
230
Even more advanced setups can be achieved by setting `module_type` to `DTS` inside [configuration](#module_type)
223
231
which will cause any `JsRoutes` instance to generate defintions instead of routes themselves.
224
232
225
-
### Sprockets (Deprecated) {#sprockets}
233
+
<divid="sprockets"></div>
234
+
235
+
### Sprockets (Deprecated)
226
236
227
237
If you are using [Sprockets](https://github.com/rails/sprockets-rails) you may configure js-routes in the following way.
0 commit comments