Skip to content

Commit 55becf5

Browse files
committed
Add README.md
1 parent ba2d15b commit 55becf5

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# @skirtle/vue-vnode-utils
2+
3+
Utilities for manipulating Vue VNodes.
4+
5+
* Docs: <https://skirtles-code.github.io/vue-vnode-utils/>
6+
* GitHub: <https://github.com/skirtles-code/vue-vnode-utils/>
7+
8+
## Installation
9+
10+
### npm
11+
12+
Installation with `npm`/`yarn`/`pnpm`:
13+
14+
```sh
15+
npm add @skirtle/vue-vnode-utils
16+
```
17+
18+
ES module usage:
19+
20+
```js
21+
import { addProps } from '@skirtle/vue-vnode-utils'
22+
```
23+
24+
### CDN - global build
25+
26+
```html
27+
<script src="https://unpkg.com/@skirtle/vue-vnode-utils/dist/vue-vnode-utils.global.dev.js"></script>
28+
```
29+
30+
This should be placed after the `<script>` tag for Vue itself, as it needs the global `Vue` to be available.
31+
32+
The functions are then exposed via the global `VueVNodeUtils`:
33+
34+
```js
35+
const { addProps } = VueVNodeUtils
36+
```
37+
38+
The URL above will include the development build, which is not minified and includes some warning messages. In production the exact version should be pinned and `.prod` should be used instead of `.dev`.
39+
40+
### CDN - ES module build
41+
42+
`@skirtle/vue-vnode-utils` imports from `vue`, so it needs an import map to be configured to use ES modules directly in the browser.
43+
44+
```html
45+
<script type="importmap">
46+
{
47+
"imports": {
48+
"vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js",
49+
"@skirtle/vue-vnode-utils": "https://unpkg.com/@skirtle/vue-vnode-utils/dist/vue-vnode-utils.esm-browser.dev.js",
50+
}
51+
}
52+
</script>
53+
<script type="module">
54+
import { addProps } from '@skirtle/vue-vnode-utils'
55+
// ...
56+
</script>
57+
```
58+
59+
As with the global build, this should be changed to an exact version and switched to `.prod` in production.
60+
61+
Some browsers do not yet have full support for import maps.
62+
63+
## License
64+
65+
MIT
66+
67+
Copyright &copy; 2022, skirtle

0 commit comments

Comments
 (0)