Как подключить HTML-Minifier-Next, чтобы глотатьJavascript

Форум по Javascript
Ответить
Anonymous
 Как подключить HTML-Minifier-Next, чтобы глотать

Сообщение Anonymous »

К сожалению, на странице проекта нет документации о том, как подключить HTML-minifier-next к Gulp.
Поиск показал мне одно решение. Я попробовал. < /P>

Код: Выделить всё

...
const htmlMinify = require('html-minifier-next');
...
function processPhp() {
return gulp.src([
source + '**/*.php'
])
.pipe(preprocess({
extension: 'php',
includeBase: source
}))
.on('data', function(file) {
const buferFile = Buffer.from(htmlMinify.minify(file.contents.toString(), options))
file.contents = buferFile;
console.log(file);
return;
})
.pipe(replace(/(?
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Promise
at Function.from (node:buffer:325:9)
at Transform. (d:\Web\gulp-assemble\gulpfile.js:693:38)
at Transform.emit (node:events:530:35)
at Transform.emit (node:domain:552:15)
at addChunk (d:\Web\gulp-assemble\node_modules\readable-stream\lib\_stream_readable.js:279:12)
at readableAddChunk (d:\Web\gulp-assemble\node_modules\readable-stream\lib\_stream_readable.js:262:11)
at Readable.push (d:\Web\gulp-assemble\node_modules\readable-stream\lib\_stream_readable.js:228:10)
at Transform.push (d:\Web\gulp-assemble\node_modules\readable-stream\lib\_stream_transform.js:132:32)
at Transform.afterTransform (d:\Web\gulp-assemble\node_modules\readable-stream\lib\_stream_transform.js:85:10)
at Transform.ppStream [as _transform] (d:\Web\gulp-assemble\node_modules\gulp-preprocess\index.js:27:5)
Какова моя ошибка?

Подробнее здесь: https://stackoverflow.com/questions/797 ... xt-to-gulp
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Javascript»