I've been attempting to use Watch for compiling my SASS files, however it seems to be not functioning as expected.
Package.json
"author": "José Ramón Rico Lara",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-imagemin": "^7.1.0",
"gulp-notify": "^3.2.0",
"gulp-sass": "^4.1.0",
"gulp-webp": "^4.0.1"
}
}
Gulpfile.js
const { series, src, watch, dest, parallel } = require('gulp');
const sass = require('gulp-sass')
const webp = require('gulp-webp');
const paths = {
scss: 'src/scss/**/*.scss',
js: 'src/js/**/*.js'
}
function css() {
return src(paths.scss)
.pipe(sass())
.pipe(dest('./build/css'))
}
function javascript() {
return src(paths.js)
.pipe(concat('bundle.js'))
.pipe(dest('./build/js'))
}
function watchArchivos() {
watch(paths.scss, css); // * = La carpeta actual - ** = Todos los archivos con esa extensión
watch(paths.js, javascript);
}
exports.css = css;
exports.javascript = javascript;
exports.watchArchivos = watchArchivos;
exports.default = series(css, javascript, watchArchivos);
The console indicates that the code is running smoothly without any errors appearing, yet when I modify a file, it fails to compile.