I have a gulp build, everything works fine, but after the build, some images are not loaded and are not displayed because the paths are different, for this I installed gulp-replace. The paths have been successfully replaced, this can be seen in the final code. But the image is not showing on the page.
And every time when I start the assembly, the picture that was missing may appear in the new assembly, but another one will be missing
What's wrong with my build?
The problem was in const cleanCSS = require("gulp-clean-css");
As I did not try to rearrange the line with renaming, nothing happened. In the minified file, the paths remain from the src parp. Temporarily removed minification
//Таск для обработки стилей
gulp.task("styles", () => {
return (
gulp
.src(styleFiles)
.pipe(sourcemaps.init())
.pipe(less())
.pipe(concat("style.css"))
.pipe(replace('url("../img/', 'url("./../img/'))
.pipe(
autoprefixer({
overrideBrowserslist: ["last 2 versions"],
cascade: false,
})
)
.pipe(sourcemaps.write("./"))
.pipe(gulp.dest("./build/css"))
.pipe(browserSync.stream())
);
});