Не создается папка img в gulp

let project_folder = "dist";

let source_folder = "#src";

let path={

    build:{

        html: project_folder + "/",

        css: project_folder + "/css/",

        js: project_folder + "/js/",

        img: project_folder + "/img/",

        fonts: project_folder + "/fonts/",

    },

    src:{

        html: [source_folder + "/*.html", "!" + source_folder + "/_*.html"],

        css: source_folder + "/scss/style.scss",

        js: source_folder + "/js/script.js",

        img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}",

        fonts: source_folder + "/fonts/*.ttf",

    },

    watch:{

        html: source_folder + "/**/*.html",

        css: source_folder + "/scss/**/*.scss",

        js: source_folder + "/js/**/*.js",

        img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}"

    },

    clean: "./" + project_folder + "/"

}

let { src, dest } = require("gulp"),

gulp = require("gulp"),

browsersync = require("browser-sync").create(),

fileinclude = require("gulp-file-include"),

del = require("del"),

scss = require("gulp-sass")(require('sass')),

autoprefixer = require("gulp-autoprefixer"),

group_media = require("gulp-group-css-media-queries"),

clean_css = require("gulp-clean-css"),

rename = require("gulp-rename"),

uglify = require("gulp-uglify-es").default,

imagemin = require("gulp-imagemin"),

webp = require('gulp-webp');

function browserSync(params) {

    browsersync.init({

        server:{

            baseDir: "./" + project_folder + "/"

        },

        port: 3000,

        notify: false

    })

}

function html() {

    return src(path.src.html)

    .pipe(fileinclude())

    .pipe(dest(path.build.html))

    .pipe(browsersync.stream())

}

function css() {

    return src(path.src.css)

    .pipe(

        scss({

            outputStyle: "expanded"

        })

    )

    .pipe(

        group_media()

    )

    .pipe(

        autoprefixer({

            overrideBrowserslist: ["last 5 versions"],

            cascade: true

        })

    )

    .pipe(dest(path.build.css))

    .pipe(clean_css())

    .pipe (

        rename({

            extname: ".min.css"

        })

    )

    .pipe(dest(path.build.css))

    .pipe(browsersync.stream())

}

function js() {

    return src(path.src.js)

    .pipe(fileinclude())

    .pipe(dest(path.build.js))

    .pipe(

        uglify()

    )

    .pipe (

        rename({

            extname: ".min.js"

        })

    )

    .pipe(dest(path.build.js))

    .pipe(browsersync.stream())

}

function images() {

    return src(path.src.img)

    .pipe(

        webp({

            quality: 70

        })

    )

    .pipe(dest(path.build.img))

    .pipe(src(path.src.img))

    .pipe(

        imagemin([

            imagemin.gifsicle({interlaced: true}),

            imagemin.mozjpeg({quality: 75, progressive: true}),

            imagemin.optipng({optimizationLevel: 5}),

            imagemin.svgo({

                plugins: [

                    {removeViewBox: true},

                    {cleanupIDs: false}

                ]

            })

        ])

    )

    .pipe(dest(path.build.img))

    .pipe(browsersync.stream())

}

function watchFiles(params) {

    gulp.watch([path.watch.html], html);

    gulp.watch([path.watch.css], css);

    gulp.watch([path.watch.js], js);

    gulp.watch([path.watch.img], images);

}

function clean(params){

    return del(path.clean);

}

let build = gulp.series(clean, gulp.parallel(images, js, css, html));

let watch = gulp.parallel(build, watchFiles, browserSync);

exports.images = images;

exports.js = js;

exports.css = css;

exports.html = html;

exports.build = build;

exports.watch = watch;

exports.default = watch;

Так а что выдает?

Полностью не покажу сейчас,
Но помню gulp-imagemin: couldn’t load default plugin “gifsicle”

PS C:\gulp\myproject> gulp
[10:36:19] Using gulpfile C:\gulp\myproject\gulpfile.js
[10:36:19] Starting 'default'...
[10:36:19] Starting 'watchFiles'...
[10:36:19] Starting 'browserSync'...
[10:36:19] Starting 'clean'...
[10:36:19] Finished 'clean' after 99 ms
[10:36:19] Starting 'images'...
[10:36:19] Starting 'js'...
[10:36:19] Starting 'css'...
[10:36:19] Starting 'html'...
[10:36:19] gulp-imagemin: Couldn't load default plugin "gifsicle"
[10:36:21] gulp-imagemin: Minified 0 images
[10:36:21] Finished 'images' after 2.41 s
[Browsersync] Access URLs:
 ------------------------------------
       Local: http://localhost:3000
    External: http://172.20.10.2:3000
 ------------------------------------
          UI: http://localhost:3001
 UI External: http://localhost:3001
 ------------------------------------
[Browsersync] Serving files from: ./dist/
[Browsersync] 1 file changed (index.html)
[10:36:22] Finished 'html' after 2.75 s
[Browsersync] 1 file changed (style.min.css)
[10:36:22] Finished 'css' after 2.8 s
[Browsersync] 1 file changed (script.min.js)
[10:36:22] Finished 'js' after 2.81 s
[Browsersync] Reloading Browsers... (buffered 3 events)

Похоже эти optionalDependencies почему-то не установились.

Гугл советует попробовать установить их или переустановить imagemin.
gulp-imagemin: Couldn't load default plugin xxx - Stack Overflow

npm install imagemin-mozjpeg imagemin-svgo imagemin-gifsicle imagemin-optipng --save

А зачем этот imagemin понадобился вообще?

Если это просто несколько картинок проекта типа лого и т.д., то лучше сразу самому их в нужном качестве/размере сделать. Тем более что если оно обещает lossless, то наверняка в большинстве случаев (если картинка создана нормальным ПО) оно сожмет максимум на несколько десятков байт. Как в примере в их ридми и есть )


При вставке кода/вывода консоли надо нажимать кнопку Код.