飞机炸弹
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
1.0 KiB

const { task, series, parallel, src, dest, watch } = require('gulp');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
const concat = require('gulp-concat');
const clean = require('gulp-clean');
const livereload = require('gulp-livereload');
const cleanTask = function () {
return src('dist/*', { read: false }).pipe(clean());
};
const script = function () {
return src('src/**/*.js')
.pipe(babel({ presets: ['@babel/env'] }))
.pipe(uglify())
.pipe(concat('main.js'))
.pipe(dest('dist/'))
.pipe(livereload({ start: true, port: 3001, reloadPage: 'dist/index.html' }));
};
const copy = function () {
src('./public/index.html').pipe(dest('dist/'));
src('./public/source-code.js').pipe(dest('dist/'));
src('./public/images/*').pipe(dest('dist/images'));
src('./public/libs/**/*').pipe(dest('dist/libs'));
src('./public/sounds/*').pipe(dest('dist/sounds'));
};
const watchTask = function () {
livereload.listen();
watch('src/*', script);
};
exports.default = parallel(copy, script, watchTask);