将gulpfile从3升级到4会出现错误

时间:2018-09-07 09:40:21

标签: visual-studio asp.net-mvc-5 gulp visual-studio-2017

这个gulp文件怎么了? (asp.net mvc 5项目)

我收到:

[11:33:02] 'min' errored after 1.26 s
Process terminated with code 1.

gulpfile.js:

/// <binding BeforeBuild='clean, min' Clean='clean' />

/// <binding Clean='clean' />
"use strict";

var gulp = require('gulp'),
  rimraf = require("rimraf"),
  concat = require("gulp-concat"),
  cssmin = require("gulp-cssmin"),
  //uglify = require("gulp-uglify");
  uglify = require("gulp-uglify-es").default;

var paths = {
  webroot: "./"
};

paths.js = paths.webroot + "Scripts/**/*.js";
paths.minJs = paths.webroot + "Scripts/**/*.min.js";
paths.css = paths.webroot + "Content/**/*.css";
paths.minCss = paths.webroot + "Content/**/*.min.css";
paths.concatJsDest = paths.webroot + "Scripts/styles.min.js";
paths.concatCssDest = paths.webroot + "Content/styles.min.css";

gulp.task("clean:js", function (cb) {
  rimraf(paths.concatJsDest, cb);
});

gulp.task("clean:css", function (cb) {
  rimraf(paths.concatCssDest, cb);
});


gulp.task('clean', gulp.series(gulp.parallel('clean:js', 'clean:css'), function (cb) { cb(); }));

gulp.task("min:js", function () {
  return gulp.src([paths.js, "!" + paths.minJs], { base: "." })
    .pipe(concat(paths.concatJsDest))
    .pipe(uglify())
    .pipe(gulp.dest("."));
});

gulp.task("min:css", function () {
  return gulp.src([paths.css, "!" + paths.minCss])
    .pipe(concat(paths.concatCssDest))
    .pipe(cssmin())
    .pipe(gulp.dest("."));
});

gulp.task('min', gulp.series(gulp.parallel('min:js', 'min:css'), function (cb) { cb(); }));

0 个答案:

没有答案