Gulp 将html minify.pipe目标压缩到原始文件夹结构

Gulp 将html minify.pipe目标压缩到原始文件夹结构,gulp,Gulp,北方的人们好,我正试图用gulp缩小我的HTML,因为我的网站太慢了 我的原始html文件的结构是 /app/blog/page1.html /app/contact/contactus.html /app/xxx/xxx.html 在我当前的代码中,gulp输出将所有html文件放入_build文件夹,但这对我来说不起作用,因为在页面加载时,它会在相应的文件夹中查找html。我是否应该/可以将缩小后的html放在其原始文件夹中,使其像正常情况一样自动引用 gulp.task('minify

北方的人们好,我正试图用gulp缩小我的HTML,因为我的网站太慢了

我的原始html文件的结构是

/app/blog/page1.html
/app/contact/contactus.html
/app/xxx/xxx.html
在我当前的代码中,gulp输出将所有html文件放入_build文件夹,但这对我来说不起作用,因为在页面加载时,它会在相应的文件夹中查找html。我是否应该/可以将缩小后的html放在其原始文件夹中,使其像正常情况一样自动引用

 gulp.task('minify-html', function () {
            return gulp.src(configHTML.src)
                .pipe(angularify())
                .pipe(minifyHTML())
                .pipe(gulp.dest('_build/'));
        });

有可能,您应该尝试更改以下代码:

gulp.src(configHTML.src, { base: "." })        
    .pipe(htmlmin({ collapseWhitespace: true, minifyCSS: true, minifyJS: true }))
    .pipe(gulp.dest("."))

这将缩小这些文件本身

如果有可能,您应该尝试更改以下代码:

gulp.src(configHTML.src, { base: "." })        
    .pipe(htmlmin({ collapseWhitespace: true, minifyCSS: true, minifyJS: true }))
    .pipe(gulp.dest("."))
这将缩小这些文件本身