Back to results
fergaldoyle/rollup-plugin-vue-template-compiler(opens in a new tab)
Language: JavaScript
- stars
- 2
- watchers
- 1
- forks
- 2
- open issues
- 1
- Last updated
- 04/04/2019
Language: JavaScript
Rollup plugin to compile Vue.js 2.0 templates.
npm i rollup-plugin-vue-template-compiler --save-dev
import vueTemplateCompiler from 'rollup-plugin-vue-template-compiler'; import buble from 'rollup-plugin-buble'; export default { entry: 'index.js', dest: 'dist/app.js', format: 'umd', plugins: [ vueTemplateCompiler({ include: '**/*.html' }), buble() ] };
import template from './template.html'
template will be an object
{ render: Function, staticRenderFns: Array<Function> }
Set render and staticRenderFns properties on a component e.g:
// manually import template from './template.html' export const myComponent = { render: template.render, staticRenderFns: template.staticRenderFns, mounted () {} } // mixin import template from './template.html' export const myComponent = { mixins: [template], mounted () {} } // stage2 object spread import template from './template.html' export const myComponent = { ...template, mounted () {} }