├── .editorconfig
├── .gitattributes
├── .gitignore
├── .prettierrc
├── LICENSE
├── README.md
├── babel.config.js
├── circle.yml
├── example
├── index.js
└── poi.config.js
├── package.json
├── src
├── index.js
└── mustUseDomProp.js
├── test
└── index.test.js
└── yarn.lock
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 2
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log
3 | .DS_Store
4 | /dist
5 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "semi": false,
3 | "singleQuote": true
4 | }
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) EGOIST <0x142857@gmail.com> (github.com/egoist)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-html
2 |
3 | [](https://npmjs.com/package/vue-html) [](https://npmjs.com/package/vue-html) [](https://circleci.com/gh/egoist/vue-html)
4 |
5 | > Use tagged template string in Vue.js render function
6 |
7 | ## Why is this useful?
8 |
9 | If you want to use Vue without a bundler / transpiler, this library will (reasonably) make your app smaller:
10 |
11 | - Vue (runtime + template compiler): 32kB gzipped
12 | - Vue (runtime + vue-html): 23kB gzipped
13 |
14 | **What's the downside?** No handy sugars like `v-model` support.
15 |
16 | ## Install
17 |
18 | ```bash
19 | $ npm install --save vue-html
20 | ```
21 |
22 | CDN versions:
23 |
24 | - `UMD`: https://unpkg.com/vue-html/dist/html.js (exposed as `window.HTML`)
25 | - `ESM`: https://unpkg.com/vue-html/dist/html.es.js
26 |
27 | ## Usage
28 |
29 | [](https://codesandbox.io/s/50qxwm44mx)
30 |
31 | ```js
32 | import Vue from 'vue'
33 | import HTML from 'vue-html'
34 |
35 | Vue.use(HTML)
36 |
37 | const Todos = {
38 | props: ['todos'],
39 | render(html) {
40 | return html`
41 |
77 | `
78 | }
79 | })
80 | ```
81 |
82 | The usage is very similar to Vue JSX except that the `html` function is powered by [HTM (Hyperscript Tagged Markup)](https://github.com/developit/htm).
83 |
84 | ### Using Components
85 |
86 | ```js
87 | const App = {
88 | render(html) {
89 | return html`
90 |
91 | <${Todos} />
92 | <${Todos}> or with children />
93 |
94 | `
95 | }
96 | }
97 | ```
98 |
99 | You can also use the traditional way of using local / global components:
100 |
101 | ```js
102 | const App = {
103 | render(html) {
104 | return html`
105 |