Skip to content

Instantly share code, notes, and snippets.

@reepush
Last active January 17, 2018 17:33
Show Gist options
  • Save reepush/7c9d1bc0b5026e0fbdd9b4548ef17df2 to your computer and use it in GitHub Desktop.
Save reepush/7c9d1bc0b5026e0fbdd9b4548ef17df2 to your computer and use it in GitHub Desktop.
Vue template loader
Vue.componentExternal = function(name, options) {
Vue.component(name, function(resolve) {
fetch(`components/${name}/${name}.html`)
.then(response => response.text())
.then(template => {
resolve(Object.assign(options, {
template: template
}))
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment