Open whqet opened 6 years ago
上课的时候用到的package.json
{
"name": "web",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-preset-env": "^1.7.0",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.1",
"gulp-uglify": "^3.0.1",
"pump": "^3.0.0"
}
}
上课时用到的gulpfile.js
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const babel = require('gulp-babel');
const pump = require('pump');
gulp.task('default',function(){
console.log('ok');
})
gulp.task('compress', function (cb) {
pump([
gulp.src('js/*.js'),
babel({
"presets": ["env"]
}),
uglify(),
gulp.dest('dist')
],
cb
);
});