Fork of the espurna firmware for `mhsw` switches
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.

43 lines
1.1 KiB

  1. var gulp = require('gulp');
  2. var plumber = require('gulp-plumber');
  3. var htmlmin = require('gulp-htmlmin');
  4. var cleancss = require('gulp-clean-css');
  5. var uglify = require('gulp-uglify');
  6. var gzip = require('gulp-gzip');
  7. var del = require('del');
  8. var useref = require('gulp-useref');
  9. var gulpif = require('gulp-if');
  10. /* Clean destination folder */
  11. gulp.task('clean', function() {
  12. return del(['data/*']);
  13. });
  14. /* Copy static files */
  15. gulp.task('files', function() {
  16. return gulp.src([
  17. 'html/**/*.{jpg,jpeg,png,ico,gif}',
  18. 'html/fsversion'
  19. ])
  20. .pipe(gulp.dest('data/'));
  21. });
  22. /* Process HTML, CSS, JS */
  23. gulp.task('html', function() {
  24. return gulp.src('html/*.html')
  25. .pipe(useref())
  26. .pipe(plumber())
  27. .pipe(gulpif('*.css', cleancss()))
  28. .pipe(gulpif('*.js', uglify()))
  29. .pipe(gulpif('*.html', htmlmin({
  30. collapseWhitespace: true,
  31. removeComments: true,
  32. minifyCSS: true,
  33. minifyJS: true
  34. })))
  35. .pipe(gzip())
  36. .pipe(gulp.dest('data'));
  37. });
  38. /* Default Task */
  39. gulp.task('default', ['clean', 'files', 'html']);