Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. // Output Gulp compilation errors to the browser via Browser-Sync:
  2. var gulp = require("gulp");
  3. var sass = require("gulp-sass");
  4. var autoprefix = require("gulp-autoprefixer");
  5. var filter = require('gulp-filter');
  6. var browserSync = require('browser-sync');
  7. var reload = browserSync.reload;
  8.  
  9. /**
  10. * Start BrowserSync
  11. */
  12. gulp.task('browser-sync', function () {
  13. browserSync({
  14. server: "./dist"
  15. });
  16. });
  17.  
  18. /**
  19. * Compile sass
  20. */
  21. gulp.task('sass', function () {
  22. return gulp.src('lib/scss/**/*.scss')
  23. .pipe(sass())
  24. .on('error', function(err){
  25. browserSync.notify(err.message, 3000);
  26. this.emit('end');
  27. })
  28. .pipe(autoprefix())
  29. .pipe(gulp.dest('lib/css'))
  30. .pipe(filter("**/*.css"))
  31. .pipe(reload({stream:true}));
  32. });
  33.  
  34. /**
  35. * Watch
  36. */
  37. gulp.task('default', ['sass', 'browser-sync'], function () {
  38. gulp.watch('lib/scss/**/*.scss', ['sass']);
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement