mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-24 08:13:38 +00:00
d1c468f909
Updating 'svgo' to v2.8.0 and newest Wikimedia SVG guidelines – mainly around new whitespace features of SVGO. Change-Id: I2b1ea90124b0f5793ffe76bc94d050654cc8baf7
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
/**
|
|
* SVGO Configuration
|
|
* Compatible to v2.4.0+
|
|
* Recommended options from:
|
|
* https://www.mediawiki.org/wiki/Manual:Coding_conventions/SVG#Exemplified_safe_configuration
|
|
*/
|
|
module.exports = {
|
|
plugins: [
|
|
{
|
|
// Set of built-in plugins enabled by default.
|
|
name: 'preset-default',
|
|
params: {
|
|
overrides: {
|
|
cleanupIDs: false,
|
|
removeDesc: false,
|
|
removeTitle: false,
|
|
removeViewBox: false,
|
|
// If the SVG doesn't start with an XML declaration, then its MIME type will
|
|
// be detected as "text/plain" rather than "image/svg+xml" by libmagic and,
|
|
// consequently, MediaWiki's CSSMin CSS minifier. libmagic's default database
|
|
// currently requires that SVGs contain an XML declaration:
|
|
// https://github.com/threatstack/libmagic/blob/master/magic/Magdir/sgml#L5
|
|
removeXMLProcInst: false
|
|
}
|
|
}
|
|
},
|
|
'removeRasterImages',
|
|
'sortAttrs'
|
|
],
|
|
// Set whitespace according to Wikimedia Coding Conventions.
|
|
// @see https://github.com/svg/svgo/blob/main/lib/svgo/coa.js#L194 for more config options
|
|
js2svg: {
|
|
eol: 'lf',
|
|
finalNewline: true,
|
|
// Configure the indent to tabs (default 4 spaces) used by `--pretty` here.
|
|
indent: '\t',
|
|
pretty: true
|
|
},
|
|
multipass: true
|
|
};
|