Skip to content

A gulp plugin used to parse Vue single-file component into wechat MINA files(wxml, wxss, js, json).

Notifications You must be signed in to change notification settings

tjeeay/gulp-mina-vue

Repository files navigation

gulp-mina-vue

A gulp plugin used to parse Vue single-file component into wechat MINA files(wxml, wxss, js, json).

Installation

$ npm i -D gulp-mina-vue

Usage

Below is just a simple demo, please refer weapp-boilerplate to see more usage in real project.

// gulpfile.js

const gulp = require('gulp')
const del = require('del')
const minaVue = require('gulp-mina-vue')

gulp.task('clean', _ => del('./dist/**/*.*'))

gulp.task('compile:MINA.wxml', _ => {
  return gulp.src('./src/**/*.vue')
  .pipe(minaVue.template())
  .pipe(gulp.dest('./dist'))
})

gulp.task('compile:MINA.wxss', _ => {
  return gulp.src('./src/**/*.vue')
  .pipe(minaVue.style())
  .pipe(gulp.dest('./dist'))
})

gulp.task('compile:MINA.js', _ => {
  return gulp.src('./src/**/*.vue')
  .pipe(minaVue.script())
  .pipe(gulp.dest('./dist'))
})

gulp.task('compile:MINA.json', _ => {
  return gulp.src('./src/**/*.vue')
  .pipe(minaVue.config())
  .pipe(gulp.dest('./dist'))
})

gulp.task('copy', _ => {
  return gulp.src([
    'src/**/*.*',
    '!src/**/*.vue'
  ])
  .pipe(gulp.dest('./dist'))
})

gulp.task('build', gulp.series(
  'clean',
  'copy',
  'compile:MINA.wxml',
  'compile:MINA.wxss',
  'compile:MINA.js',
  'compile:MINA.json'
))

License

MIT

About

A gulp plugin used to parse Vue single-file component into wechat MINA files(wxml, wxss, js, json).

Resources

Stars

Watchers

Forks

Packages

No packages published