gulp-watch-sass
Watches for SASS files modifications thanks to gulp-watch
, while adding @import
ing SASS files to the stream thanks to gulp-fn
.
State
Install
npm install --save-dev gulp-watch-sass
Usage
const gulp = const sass = const watchSass = gulp;
API
watchSass(glob, [options])
Creates a watcher that will spy on files that are matched by glob
which can be a glob string or array of glob strings. On file change, the modified file and the @import
ing files will be added to the stream.
You can watch for CSS files modifications in addition to SASS ones. In this case, if the modified file is a CSS file, then only the @import
ing files will be added to the stream.
options
This object is passed to the gulp-watch
options directly.
options.includePaths
Mimics node-sass' includePaths
option.
Why?
gulp.watch
recompiles all the SASS files:
gulp; gulp;
This works well, but each time a SASS file is updated, all the project's SASS files are recompiled, which can be quite long when working on big projects.
gulp-watch
doesn't take @import
ing files into account:
gulp;
This recompiles only modified SASS files, but because @import
statements are not resolved, the stylesheets may not be refreshed as expected.