38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
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'),
|
||
notify = require('gulp-notify'),//提示信息
|
||
stripDebug = require("gulp-strip-debug"),//移除console语句
|
||
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('minifyjsfc', function() {
|
||
return gulp.src('fc/js/*.js')
|
||
// .pipe(concat('main.js'))
|
||
// .pipe(rename({suffix: '.min'}))
|
||
//https://github.com/mishoo/UglifyJS2
|
||
.pipe(uglify({
|
||
mangle:false,
|
||
compress:false,
|
||
output: {
|
||
comments: false //保留注释, all: 保留所有,some:只保留license等信息,false: 不保留,正则或者function
|
||
}
|
||
}))
|
||
.pipe(stripDebug())
|
||
.pipe(gulp.dest('fc/dist/js'))
|
||
.pipe(notify({message: 'finished dist'}));
|
||
});
|
||
|
||
gulp.task('default', ['jslint'], function() {
|
||
gulp.start('minifyjsfc');
|
||
});
|