-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated: improve the documentation in the readme file
- Loading branch information
1 parent
3999e72
commit 735e7be
Showing
1 changed file
with
17 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,24 +27,25 @@ It doesn't need Riot.js to work and can be used as standalone module. | |
|
||
We have 2 editions: | ||
|
||
| edition | file | | ||
| :------------------ | :------------- | | ||
| **UMD Version** | `index.umd.js` | | ||
| **ESM Module** | `index.js` | | ||
| **Commonjs Module** | `index.cjs` | | ||
| edition | file | | ||
|:--------------------------|:--------------------------| | ||
| **ESM Module** | `index.js` | | ||
| **UMD Version** | `index.umd.js` | | ||
| **Standalone ESM Module** | `index.standalone.js` | | ||
| **Standalone UMD Module** | `index.standalone.umd.js` | | ||
|
||
### Script injection | ||
|
||
```html | ||
<script src="https://unpkg.com/@riotjs/[email protected]/route.js"></script> | ||
<script src="https://unpkg.com/@riotjs/[email protected]/index.umd.js"></script> | ||
``` | ||
|
||
_Note_: change the part `x.x.x` to the version numbers what you want to use: ex. `4.5.0` or `4.7.0`. | ||
|
||
### ESM module | ||
|
||
```js | ||
import { route } from 'https://unpkg.com/@riotjs/route/route.esm.js' | ||
import { route } from 'https://unpkg.com/@riotjs/route/index.js' | ||
``` | ||
|
||
### npm | ||
|
@@ -163,6 +164,15 @@ Each `<route>` component has its own lifecycle attributes in order to let you kn | |
This module was not only designed to be used with Riot.js but also as standalone module. | ||
Without importing the Riot.js components in your application you can use the core methods exported to build and customize your own router compatible with any kind of frontend setup. | ||
|
||
Depending on your project setup you might import it as follows: | ||
```js | ||
|
||
// in a Riot.js application | ||
import { route } from '@riotjs/route' | ||
|
||
// in a standalone context | ||
import { route } from '@riotjs/route/standalone' | ||
``` | ||
#### Fundamentals | ||
|
||
This module works on node and on any modern browser, it exports the `router` and `router` property exposed by [rawth](https://github.com/GianlucaGuarini/rawth) | ||
|