app-xiangsonghua/app-saas-src/gulpFile.js

78 lines
2.0 KiB
JavaScript
Raw Permalink Normal View History

2024-12-26 17:00:06 +08:00
var gulp = require('gulp');
var gutil = require('gulp-util');
var watch = require('gulp-watch');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
var imagemin = require('gulp-imagemin');
var cleancss = require('gulp-clean-css');
var distBase = "../app-saas/widget"
gulp.task("watch", function () {
watch("./script/**/*.js", function (e) {
gulp.src(e.path, { base: './script' })
//.pipe(uglify())
.pipe(gulp.dest(distBase + "/script"))
})
watch("./css/**/*.css", function (e) {
gulp.src(e.path, { base: './css' })
.pipe(gulp.dest(distBase + "/css"))
})
watch("./image/**/*", function (e) {
gulp.src(e.path, { base: './image' })
.pipe(gulp.dest(distBase + "/image"))
})
watch(["./index.html", "./config.xml"], function (e) {
gulp.src(e.path, { base: './' })
.pipe(gulp.dest(distBase))
})
watch("./resource/**/*", function (e) {
gulp.src(e.path, { base: './resource' })
.pipe(gulp.dest(distBase + "/resource"))
})
watch("./icon/**/*", function (e) {
gulp.src(e.path, { base: './icon' })
.pipe(gulp.dest(distBase + "/icon"))
})
watch("./html/**/*", function (e) {
gulp.src(e.path, { base: './html' })
.pipe(gulp.dest(distBase + "/html"))
})
})
gulp.task("release", function () {
gulp.src("./script/**/*.js", { base: './script' })
.pipe(uglify())
.on('error', function (err) {
gutil.log(gutil.colors.red('[Error1]'), err.toString())
})
.pipe(gulp.dest(distBase + "/script"))
gulp.src("./css/**/*.css", { base: "./css" })
.pipe(gulp.dest(distBase + "/css"))
gulp.src("./image/**/*", { base: "./image" })
.pipe(gulp.dest(distBase + "/image"))
gulp.src(["./index.html", "./config.xml"], { base: './' })
.pipe(gulp.dest(distBase))
gulp.src("./resource/**/*", { base: './resource' })
.pipe(gulp.dest(distBase + "/resource"))
gulp.src("./icon/**/*", { base: './icon' })
.pipe(gulp.dest(distBase + "/icon"))
gulp.src("./html/**/*", { base: './html' })
.pipe(gulp.dest(distBase + "/html"))
})