Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';                                                                                                                        
  2.  
  3. const gulp = require('gulp');
  4. const sass = require('gulp-sass');
  5. const browserSync = require('browser-sync');
  6.  
  7. sass.compiler = require('node-sass');
  8.  
  9. gulp.task('sass', function() {
  10.   return gulp.src('./css/*.scss')
  11.       .pipe(sass().on('error', sass.logError))
  12.       .pipe(gulp.dest('./css'));
  13. });
  14.  
  15. gulp.task('sass:watch', function() {
  16.   gulp.watch('./css/*.scss', gulp.series('sass', browserSync.reload));
  17. });
  18.  
  19. gulp.task('browser-sync', function() {
  20.   const files = [
  21.     './*.html',
  22.     './css/*.css',
  23.     './js/*.js',
  24.     './img/*.{png,jpg,gif}',
  25.   ];
  26.  
  27.   browserSync.init(files, {
  28.     server: {
  29.       baseDir: './',
  30.     },
  31.   });
  32. });
  33.  
  34. gulp.task('default', gulp.series('browser-sync', 'sass:watch'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement