Galerie und tage

This commit is contained in:
2021-11-23 17:56:26 +01:00
parent ff35366279
commit 5f873bee89
4693 changed files with 149659 additions and 301447 deletions

53
node_modules/imagemin-svgo/index.js generated vendored
View File

@@ -1,18 +1,47 @@
'use strict';
const isSvg = require('is-svg');
const SVGO = require('svgo');
module.exports = options => buffer => {
options = Object.assign({multipass: true}, options);
var isSvg = require('is-svg');
var SVGO = require('svgo');
var through = require('through2');
if (!isSvg(buffer)) {
return Promise.resolve(buffer);
}
module.exports = function (opts) {
opts = opts || {};
if (Buffer.isBuffer(buffer)) {
buffer = buffer.toString();
}
return through.ctor({objectMode: true}, function (file, enc, cb) {
if (file.isNull()) {
cb(null, file);
return;
}
const svgo = new SVGO(options);
return svgo.optimize(buffer).then(result => Buffer.from(result.data));
if (file.isStream()) {
cb(new Error('Streaming is not supported'));
return;
}
if (!isSvg(file.contents)) {
cb(null, file);
return;
}
try {
var svgo = new SVGO(opts);
svgo.optimize(file.contents.toString('utf8'), function (res) {
if (!res.data || !res.data.length) {
return;
}
res.data = res.data.replace(/&(?!amp;)/g, '&');
res.data = new Buffer(res.data);
file.contents = res.data;
});
} catch (err) {
err.fileName = file.path;
cb(err);
return;
}
cb(null, file);
});
};