Skip to content

Instantly share code, notes, and snippets.

@Akhigbe-E
Created July 9, 2020 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akhigbe-E/f53e1cce3d4b65c5cb45fe54db3a6223 to your computer and use it in GitHub Desktop.
Save Akhigbe-E/f53e1cce3d4b65c5cb45fe54db3a6223 to your computer and use it in GitHub Desktop.
Watch sass folder
const gulp = require('gulp')
const sass = require('gulp-sass')
const transpileSassToCss = (cb) => {
return gulp.src(`src/sass/main.scss`)
.pipe(sass())
.pipe(gulp.dest(`src/css`))
}
const watchSassFile = () => {
// If you want to run the transpileSassToCss function when
// multiple files are changed, put the file paths in the array
return gulp.watch(['src/sass/**/*.scss'], transpileSassToCss)
// This glob tells gulp to watch all the files suffixed with .scss
// in the sass folder & in folders in the sass folder
}
exports.default = watchSassFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment