1.0.3 • Published 7 years ago

rollup-plugin-vue-template-compiler v1.0.3

Weekly downloads
20
License
MIT
Repository
github
Last release
7 years ago

rollup-plugin-vue-template-compiler

Rollup plugin to compile Vue.js 2.0 templates.

npm i rollup-plugin-vue-template-compiler --save-dev

Sample rollup config

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()
  ]
};

Usage

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 () {}
}
1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago