gulpfile.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. var gulp = require('gulp');
  2. var concat = require('gulp-concat');
  3. var uglify = require('gulp-uglify');
  4. var babel = require('gulp-babel');
  5. var filesExist = require('files-exist');
  6. var maps = require('gulp-sourcemaps');
  7. var gulpSequence = require('gulp-sequence');
  8. var files = [
  9. './source/jquery.canvaswrapper.js',
  10. './source/jquery.colorhelpers.js',
  11. './source/jquery.flot.js',
  12. './source/jquery.flot.saturated.js',
  13. './source/jquery.flot.browser.js',
  14. './source/jquery.flot.drawSeries.js',
  15. './source/jquery.flot.errorbars.js',
  16. './source/jquery.flot.uiConstants.js',
  17. './source/jquery.flot.logaxis.js',
  18. './source/jquery.flot.symbol.js',
  19. './source/jquery.flot.flatdata.js',
  20. './source/jquery.flot.navigate.js',
  21. './source/jquery.flot.fillbetween.js',
  22. './source/jquery.flot.stack.js',
  23. './source/jquery.flot.touchNavigate.js',
  24. './source/jquery.flot.hover.js',
  25. './source/jquery.flot.touch.js',
  26. './source/jquery.flot.time.js',
  27. './source/jquery.flot.axislabels.js',
  28. './source/jquery.flot.selection.js',
  29. './source/jquery.flot.composeImages.js',
  30. './source/jquery.flot.legend.js'
  31. ];
  32. gulp.task('build_flot_source', function() {
  33. return gulp.src(filesExist(files, { exceptionMessage: 'Missing file' }))
  34. .pipe(concat('jquery.flot.js'))
  35. .pipe(gulp.dest('dist/source'));
  36. });
  37. gulp.task('build_flot_minified', function() {
  38. return gulp.src(filesExist(files, { exceptionMessage: 'Missing file' }))
  39. .pipe(maps.init())
  40. .pipe(babel({
  41. "presets": [
  42. "@babel/preset-env"
  43. ]
  44. }))
  45. .pipe(concat('jquery.flot.js'))
  46. .pipe(uglify())
  47. .pipe(maps.write('./'))
  48. .pipe(gulp.dest('dist/es5'));
  49. });
  50. gulp.task('build', gulp.series('build_flot_source', 'build_flot_minified'));