gulpfile.js 801 B

1234567891011121314151617181920212223242526272829303132
  1. const gulp = require('gulp');
  2. const uglifyES = require('uglify-es');
  3. const composer = require('gulp-uglify/composer');
  4. const concat = require('gulp-concat');
  5. const del = require('del');
  6. const uglify = composer(uglifyES, console);
  7. const clean = () => del(['dist/*']);
  8. const buildNormal = () => {
  9. return gulp.src('./dist/countUp.js')
  10. .pipe(concat('countUp.min.js'))
  11. .pipe(uglify())
  12. .pipe(gulp.dest('dist'));
  13. }
  14. const buildLegacy = () => {
  15. return gulp.src([
  16. './requestAnimationFrame.polyfill.js',
  17. './dist/countUp.js'
  18. ])
  19. .pipe(concat('countUp.withPolyfill.min.js'))
  20. .pipe(uglify())
  21. .pipe(gulp.dest('dist'));
  22. }
  23. gulp.task('clean', clean);
  24. const build = gulp.series(buildNormal, buildLegacy);
  25. gulp.task('build', build);
  26. exports.clean = clean;
  27. exports.default = build;