gulpfile.js 631 B

12345678910111213141516171819202122232425262728
  1. const gulp = require('gulp'),
  2. sass = require('gulp-sass')(require('sass')),
  3. browserSync = require('browser-sync').create();
  4. function mixin() {
  5. return gulp.src('./css/*.scss')
  6. .pipe(sass().on('error',sass.logError))
  7. .pipe(gulp.dest('./css/'))
  8. .pipe(browserSync.stream());
  9. }
  10. function run() {
  11. browserSync.init({
  12. server: {
  13. baseDir: "./",
  14. index: "/index.html"
  15. }
  16. });
  17. gulp.watch('./css/*.scss', mixin);
  18. gulp.watch([
  19. './*.html',
  20. './css/**/*.css',
  21. './js/**/*.js'
  22. ]).on('change',browserSync.reload);
  23. console.log("🔥 Run");
  24. }
  25. exports.mixin = mixin;
  26. exports.run = run;