gulpfile.js 550 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. var gulp = require('gulp');
  3. var watch = require('gulp-watch');
  4. var jsmin = require('gulp-jsmin');
  5. var rename = require('gulp-rename');
  6. function handleError(err) {
  7. console.log(err.toString());
  8. // this.emit('end');
  9. }
  10. gulp.task('scripts', done => {
  11. gulp.src('./js/*.js')
  12. .pipe(jsmin())
  13. .pipe(rename({suffix: '.min'}))
  14. .pipe(gulp.dest('./js/dist/'));
  15. done()
  16. });
  17. // default gulp task
  18. gulp.task('default', gulp.series('scripts', function(done) {
  19. gulp.watch('./js/*.js', gulp.series('scripts'));
  20. done()
  21. }));