simplytest-8.x-4.x-dev/themes/simplytest_theme/gulp-tasks/watch.js
themes/simplytest_theme/gulp-tasks/watch.js
/**
* @file
* Task: Lint & Watch Sass.
* Usage: gulp watch
*/
module.exports = function (gulp, options, plugins) {
'use strict';
function lintFile(file) {
gulp.src(file)
.pipe(plugins.sassLint())
.pipe(plugins.sassLint.format());
}
// Keep an eye on Sass files for changes and only lint changed files
gulp.task('watch', function () {
gulp.watch([
options.sass.sassFiles
], function (ev) {
if (ev.type === 'added' || ev.type === 'changed') {
lintFile(ev.path);
}
});
// Compile sass changes
gulp.watch([
options.sass.sassFiles
],
gulp.series('sass'));
});
};
