当我尝试添加images.js时,出现以下问题。图片转换成功
Barcelona@DESKTOP-DJ763J5 MINGW64 ~/Desktop/Filancer_gulp
$ gulp.
[21:33:06] gulp-notify: [IMAGES] Error: File not found with singular glob: C:/Users/Barcelona/Desktop/Filancer_gulp/dist/img/ (if this was purposeful, use `allowEmpty` option)
[gulp-version-number] Output to file: gulp/version.json
[21:33:06] Finished 'html' after 405 ms
[21:33:06] Finished 'copy' after 407 ms
[21:33:06] Finished 'scss' after 407 ms
[21:33:06] asset app.min.js 140 KiB [emitted] (name: main)
webpack 5.88.2 compiled successfully
[21:33:06] Finished 'js' after 606 ms
[21:33:12] gulp-imagemin: Minified 0 images
[21:33:12] Finished 'images' after 6.32 s
[21:33:12] Starting 'watcher'...
[21:33:12] Starting 'server'...
[Browsersync] Access URLs:
-----------------------------------
Local: http://localhost:3000
External: http://10.0.0.106:3000
-----------------------------------
UI: http://localhost:3001
UI External: http://localhost:3001
-----------------------------------
[Browsersync] Serving files from: ./dist/
我的 images.js 代码是:
import webp from "gulp-webp";
import imagemin from "gulp-imagemin";
export const images = () => {
return app.gulp.src(app.path.src.images)
.pipe(app.plugins.plumber(
app.plugins.notify.onError({
title: "IMAGES",
message: "Error: <%= error.message %>"
}))
)
.pipe(app.plugins.newer(app.path.build.images))
.pipe(webp())
.pipe(app.gulp.dest(app.path.build.images))
.pipe(app.gulp.src(app.path.build.images))
.pipe(app.plugins.newer(app.path.build.images))
.pipe(imagemin({
progressive: true,
svgoPlugins: [{ removeViewBox: false }],
interlaced: true,
optimizationLevel: 3 // 0 to 7
}))
.pipe(app.gulp.dest(app.path.build.images))
.pipe(app.gulp.src(app.path.src.svg))
.pipe(app.gulp.dest(app.path.build.images))
.pipe(app.plugins.browsersync.stream());
}
怎么了?
我尝试在path.js中查找问题,但没有成功。我该怎么办?