I am trying to automate a task with watch, in gulp. I am a beginner at this.
This is code:
const { series, src, dest, watch } = require('gulp');
const sass = require('gulp-sass');
// Función que compila SASS
function css( ) {
return src('src/scss/app.scss')
.pipe( sass())
.pipe( dest('./build/css') )
}
function minificarcss() {
return src('src/scss/app.scss')
.pipe( sass ({
outputStyle: 'compressed'
}))
.pipe( dest('./build/css') )
}
function watchArchivos() {
watch('src/scss/**/*.scss', css ); // * = La carpeta actual - ** = Todos los archivos con esa extensión
}
exports.css = css;
exports.minificarcss = minificarcss;
exports.watchArchivos = watchArchivos;
This is the error, I have no idea why it happens, all files are well written.
Error:
PS C:\Users\Usuario\Desktop\FestivalMusica_inicio> gulp watchArchivos
[07:47:10] Using gulpfile ~\Desktop\FestivalMusica_inicio\gulpfile.js
[07:47:10] Starting 'watchArchivos'...
[07:47:41] Starting 'css'...
[07:47:41] 'css' errored after 19 ms
[07:47:41] Error: File not found with singular glob: C:/Users/Usuario/Desktop/FestivalMusica_inicio/src/scss/app.scss (if this was purposeful, use `allowEmpty` option)
The path of the directories is well written:
Confirm that the file: 'C:/Users/Usuario/Desktop/FestivalMusica_inicio/src/scss/app.scss' is written correctly. Sometimes we forget something. This problem, that's it, the file does not exist.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.