https://github.com/fergaldoyle/rollup-plugin-vue-template-compiler
https://github.com/fergaldoyle/rollup-plugin-vue-template-compiler
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fergaldoyle/rollup-plugin-vue-template-compiler
- Owner: fergaldoyle
- Created: 2016-09-30T09:29:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-04-03T15:00:48.000Z (over 6 years ago)
- Last Synced: 2025-08-03T21:32:02.443Z (5 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```javascript
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
```javascript
{
render: Function,
staticRenderFns: Array
}
```
Set `render` and `staticRenderFns` properties on a component e.g:
```javascript
// 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 () {}
}
```