2.0.1 • Published 6 years ago

rollup-plugin-vue-template v2.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

rollup-plugin-vue-template

Rollup plugin to compile Vue.js 2.0 templates.

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

Sample rollup config

import vueTemplate from 'rollup-plugin-vue-template';
import buble from 'rollup-plugin-buble';

export default {
  entry: 'index.js',
  dest: 'dist/app.js',
  format: 'umd',
  plugins: [
    vueTemplate(),
    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 () {}
}
2.0.1

6 years ago

2.0.0

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago