An open API service indexing awesome lists of open source software.

https://github.com/unitejs/gulp-inline-vue-template


https://github.com/unitejs/gulp-inline-vue-template

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# Gulp Inline Vue

This plugin will allow you to use url syntax in your template line to compile and inline templates in your source code.

Also any inline templates will be compiled as well.

## Installation

```shell
npm install gulp-inline-vue-template --save-dev
```

## Usage

If your template line looks like it is including a vue file then it will be compiled and inlined during the gulp pipe process.

myView.js

```javascript
@Component({
template: "./myView.vue"
})
export class MyView extends Vue {
}
```

myView.vue

```html

Hello World!

```

If you then pipe your source through the plugin during your gulp processing as follows:

```javascript
var inlineVue = require('gulp-inline-vue-template');

gulp.task('inline-vue', function () {
return gulp.src('./src/**/*.js')
.pipe(inlineVue())
.pipe(gulp.dest('./dist'));
});
```

Your output will be:

myView.js

```javascript
@Component({
template: function anonymous() {
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',[_vm._v("Hello World!")])
}
})
export class MyView extends Vue {
}
```