vue-html
Use tagged template string in Vue.js render function
Why is this useful?
If you want to use Vue without a bundler / transpiler, this library will (reasonably) make your app smaller:
- Vue (runtime + template compiler): 32kB gzipped
- Vue (runtime + vue-html): 23kB gzipped
What's the downside? No handy sugars like v-model
support.
Install
$ npm install --save vue-html
CDN versions:
UMD
: https://unpkg.com/vue-html/dist/html.js (exposed aswindow.HTML
)ESM
: https://unpkg.com/vue-html/dist/html.es.js
Usage
Vue const Todos = props: 'todos' { return html` ` } el: '#app' data: todos: 'Conquer the world' 'Rewrite Peco' todo: '' methods: { thistodos thistodo = '' } { return html` this.todo = e.target.value} /> Add < todos= /> ` }
The usage is very similar to Vue JSX except for that the html
function is powered by HTM (Hyperscript Tagged Markup).
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D