var gulp = require('gulp'), concat = require('gulp-concat'), // uglify = require('gulp-uglify'), uglify = require('gulp-uglify-es').default, rename = require('gulp-rename'), jshint = require('gulp-jshint'), stripDebug = require("gulp-strip-debug"),//移除console语句 cleanCSS = require('gulp-clean-css'), gutil = require('gulp-util'); gulp.task('jslint', function () { return gulp.src('fc/js/*.js') .pipe(jshint()) .pipe(jshint.reporter('default')) .pipe(notify({message: 'finished jslint'})); }); gulp.task('disthtml', function(){ return gulp.src(['**/*.html', '!node_modules/**/*', '!dist/**/*']) .pipe(gulp.dest('dist')); }) gulp.task('distfccss', function() { return gulp.src(['fc/css/**/*.css']) .pipe(cleanCSS()) .pipe(gulp.dest('dist/fc/css')); }) gulp.task('distfcstatic', function() { return gulp.src(['fc/resources/**/*']) .pipe(gulp.dest('dist/fc/resources')); }) gulp.task('distfcjs', function() { return gulp.src(['fc/js/*.js']) // .pipe(concat('main.js')) // .pipe(rename({suffix: '.min'})) //https://github.com/mishoo/UglifyJS2 .pipe(uglify({ mangle:true, compress:true, output: { comments: false //保留注释, all: 保留所有,some:只保留license等信息,false: 不保留,正则或者function } })) .pipe(stripDebug()) .pipe(gulp.dest('dist/fc/js')); }); gulp.task('distfc', ['disthtml', 'distfcjs', 'distfccss', 'distfcstatic']) gulp.task('default', ['distfc']);