vtc

vue-template-compiler-loader

Webpack loader to pre-compile Vue 2.0 templates

Showing:

Popularity

Downloads/wk

154

GitHub Stars

25

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

0

Size (min+gzip)

0.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

vue-template-compiler-loader

Webpack loader to pre-compile Vue 2.0 templates.

npm i vue-template-compiler-loader --save-dev

Webpack config

To module.loaders add:

{ test: /\.html$/, loader: 'vue-template-compiler' }

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 = {
  name: 'myComponent',
  render: template.render,
  staticRenderFns: template.staticRenderFns,
  mounted () {}
}



// mixin
import template from './template.html'

export const myComponent = {
  name: 'myComponent',
  mixins: [template],
  mounted () {}
}



// stage2 object spread
import template from './template.html'

export const myComponent = {
  name: 'myComponent',
  ...template,
  mounted () {}
}

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial