Guest User

Untitled

a guest
Mar 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. var gulp = require('gulp');
  2. var pug = require('gulp-pug');
  3. var less = require('gulp-less');
  4. var path = require('path');
  5. var browserSync = require('browser-sync').create();
  6. /******* tasks ********/
  7. gulp.task('browserSync', function() {
  8. browserSync.init({
  9. server: "./"
  10. });
  11. })
  12. gulp.task('pug', function() {
  13. return gulp.src('pug/*.pug')
  14. .pipe(pug({
  15. pretty: true
  16. }))
  17. .pipe(gulp.dest('./'))
  18. .on("end", browserSync.reload)
  19. });
  20. gulp.task('less', function() {
  21. return gulp.src('style/*.less')
  22. .pipe(less({
  23. paths: [path.join(__dirname, 'less', 'includes')]
  24. }))
  25. .pipe(gulp.dest('./css'))
  26. .pipe(browserSync.reload({stream: true}))
  27. });
  28. /******* watch ********/
  29. gulp.task('watch', ['browserSync', 'pug', 'less'], function() {
  30. gulp.watch("style/*.less", ['less']);
  31. gulp.watch("pug/*.pug", ['pug']);
  32. gulp.watch("pug/includes/*.pug", ['pug']);
  33. gulp.watch('*.html', browserSync.reload);
  34. });
  35. /******* default ********/
  36. gulp.task('default', ['watch']);
Add Comment
Please, Sign In to add comment