emulator/gulpfile.js

48 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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']);