mirror of https://github.com/curbengh/hexo-yam
feat: support native brotli
This commit is contained in:
parent
60a045e429
commit
e473408673
|
@ -7,7 +7,7 @@ const Svgo = require('svgo')
|
|||
const zlib = require('zlib')
|
||||
const { promisify } = require('util')
|
||||
const gzip = promisify(zlib.gzip)
|
||||
const br = require('iltorb')
|
||||
const br = require('zlib').brotliCompress ? promisify(require('zlib').brotliCompress) : require('iltorb').compress
|
||||
const micromatch = require('micromatch')
|
||||
|
||||
const isMatch = (path, patterns, options) => {
|
||||
|
@ -194,7 +194,7 @@ function brotliFn () {
|
|||
const input = Buffer.from(assetTxt, 'utf-8')
|
||||
|
||||
try {
|
||||
const result = await br.compress(input)
|
||||
const result = await br(input)
|
||||
if (options.logger) verbose.call(this, input, result.toString(), path, 'brotli')
|
||||
resolve(route.set(path + '.br', result))
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue