0.2.2 • Published 7 years ago

vue-templatify v0.2.2

Weekly downloads
3
License
http://kitak.mit-...
Repository
github
Last release
7 years ago

vue-templatify

Browserify transform for Vue.js 2.0 template

This transform is just pre-compile a template by using vue-templatify and provide a function that can inject render function to a component options object.

Usually, you had better to use vueify.

Usage

npm install vue-templatify --save-dev
browserify -t vue-templatify -e src/main.js -o dist/build.js

Example code

Write a template of Vue component as html.

<!-- app.html -->
<div class="app">
  <p>{{ text }}</p>
  <button type="button" @click="log">Log</button>
</div>

Import it as a function and pass a component option to the function.

// app.js
import withRender from './app.html'

export default withRender({
  data () {
    return {
      text: 'Example text'
    }
  },

  methods: {
    log () {
      console.log('output log')
    }
  }
})

License

MIT