Advertisement
Guest User

Untitled

a guest
Sep 17th, 2015
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. var gulp = require('gulp');
  2. var sourcemaps = require('gulp-sourcemaps');
  3. var babel = require('gulp-babel');
  4. var livereload = require('gulp-livereload');
  5. var concat = require('gulp-concat');
  6.  
  7. gulp.slurped = false;
  8.  
  9. gulp.task('copyHTML', function(){
  10. gulp.src('src/*.html')
  11. .pipe(gulp.dest("public"));
  12. });
  13.  
  14. gulp.task('babel', function(){
  15. gulp.src("src/**/*.js")
  16. .pipe(sourcemaps.init())
  17. .pipe(babel())
  18. .pipe(concat("main.js"))
  19. .pipe(sourcemaps.write("."))
  20. .pipe(gulp.dest("dist"));
  21. });
  22.  
  23. gulp.task('watch', function(){
  24. livereload.listen();
  25. if(!gulp.slurped){
  26. gulp.watch('gulpfile.js', ['default']);
  27. gulp.watch('src/*.html', ['copyHTML']);
  28. gulp.watch('src/js/**/*.js', ['babel']);
  29. gulp.slurped = true;
  30. }
  31. });
  32.  
  33. gulp.task('default', ['watch']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement