Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. const del = require('del');
  2. const gulp = require('gulp');
  3. const elm = require('gulp-elm');
  4. const connect = require('gulp-connect');
  5. const plumber = require('gulp-plumber');
  6.  
  7. const paths = {
  8. dest: 'dist',
  9. elm: 'src/**/*.elm',
  10. static: 'src/**/*.{html,css}',
  11. }
  12.  
  13. gulp.task('clean', (cb) => del([paths.dest], cb));
  14.  
  15. gulp.task('static', () => gulp
  16. .src(paths.static)
  17. .pipe(plumber())
  18. .pipe(gulp.dest(paths.dest))
  19. .pipe(connect.reload())
  20. );
  21.  
  22. gulp.task('elm-init', elm.init);
  23.  
  24. gulp.task('elm', ['elm-init'], () => gulp
  25. .src(paths.elm)
  26. .pipe(plumber())
  27. .pipe(elm())
  28. .pipe(gulp.dest(paths.dest))
  29. .pipe(connect.reload())
  30. );
  31.  
  32. gulp.task('connect', () => {
  33. connect.server({
  34. root: paths.dest,
  35. livereload: true
  36. })
  37. });
  38.  
  39. gulp.task('watch', () => {
  40. gulp.watch(paths.elm, ['elm'])
  41. gulp.watch(paths.static, ['static'])
  42. })
  43.  
  44. gulp.task('build', ['static', 'elm']);
  45. gulp.task('dev', ['build', 'connect', 'watch']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement