Skip to content

Commit c73dbf4

Browse files
committed
Merge branch 'master' of github.com:railsware/js-routes
2 parents d93bf0d + 76d044c commit c73dbf4

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

Readme.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ There are several possible ways to setup JsRoutes:
2929
4. [Sprockets](#sprockets) - Legacy
3030
* Deprecated and not recommended for modern apps
3131

32-
<div id='quick-start'></div>
33-
34-
### Quick Start
32+
### Quick Start {#quick-start}
3533

3634
Setup [Rack Middleware](https://guides.rubyonrails.org/rails_on_rack.html#action-dispatcher-middleware-stack)
3735
to automatically generate and maintain `routes.js` file and corresponding
@@ -77,13 +75,10 @@ Add js-routes files to `.gitignore`:
7775
/app/javascript/routes.d.ts
7876
```
7977

80-
<div id='webpacker'></div>
81-
82-
### Webpacker ERB loader
78+
### Webpacker ERB loader {#webpack}
8379

8480
**IMPORTANT**: the setup doesn't support IDE autocompletion with [Typescript](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html)
8581

86-
8782
#### Use a Generator
8883

8984
Run a command:
@@ -133,17 +128,15 @@ Create routes file `app/javascript/routes.js.erb`:
133128
<%= JsRoutes.generate() %>
134129
```
135130

136-
Use routes wherever you need them:
131+
Use routes wherever you need them:
137132

138133
``` javascript
139134
import {post_path} from 'routes.js.erb';
140135

141136
alert(post_path(2));
142137
```
143138

144-
<div id='advanced-setup'></div>
145-
146-
### Advanced Setup
139+
### Advanced Setup {#advanced-setup}
147140

148141
In case you need multiple route files for different parts of your application, there are low level methods:
149142

@@ -208,11 +201,9 @@ class AdvancedJsRoutesMiddleware < JsRoutes::Middleware
208201
end
209202
```
210203

211-
<div id='definitions'></div>
212-
213-
#### Typescript Definitions
204+
#### Typescript Definitions {#definitions}
214205

215-
JsRoutes has typescript support out of the box.
206+
JsRoutes has typescript support out of the box.
216207

217208
Restrictions:
218209

@@ -224,16 +215,14 @@ More advanced setup would involve calling manually:
224215

225216
``` ruby
226217
JsRoutes.definitions! # to output to file
227-
# or
218+
# or
228219
JsRoutes.definitions # to output to string
229220
```
230221

231222
Even more advanced setups can be achieved by setting `module_type` to `DTS` inside [configuration](#module_type)
232223
which will cause any `JsRoutes` instance to generate defintions instead of routes themselves.
233224

234-
<div id="sprockets"></div>
235-
236-
### Sprockets (Deprecated)
225+
### Sprockets (Deprecated) {#sprockets}
237226

238227
If you are using [Sprockets](https://github.com/rails/sprockets-rails) you may configure js-routes in the following way.
239228

0 commit comments

Comments
 (0)