以下代码不起作用。我正在尝试通过“vinyl-source-stream”插件将“html-minifier”插件连接到“gulp” 。
我为什么要这样做?我在此页面上读到您可以连接插件“browserify”。我写了这段代码,但它给出了一个错误。我该如何解决?
'use strict';
const { src, dest, series } = require('gulp')
const htmlMinify = require('html-minifier').minify;
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const options = {
includeAutoGeneratedTags: true,
removeAttributeQuotes: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
sortClassName: true,
useShortDoctype: true
};
const result = htmlMinify('frontend/*.html', options)
function test() {
return result.bundle()
.pipe(source('frontend/**/*.html'))
.pipe(buffer())
.pipe(dest('public'))
}
exports.build = series(test)