2021-04-12 20:24:01 +00:00
|
|
|
/**
|
|
|
|
* SVGO Configuration
|
2023-06-15 15:29:13 +00:00
|
|
|
* Compatible to v3.0.0+
|
2021-04-12 20:24:01 +00:00
|
|
|
* Recommended options from:
|
|
|
|
* https://www.mediawiki.org/wiki/Manual:Coding_conventions/SVG#Exemplified_safe_configuration
|
|
|
|
*/
|
2023-04-03 22:14:55 +00:00
|
|
|
|
2023-06-15 15:29:13 +00:00
|
|
|
'use strict';
|
|
|
|
|
2021-04-12 20:24:01 +00:00
|
|
|
module.exports = {
|
2022-02-27 11:58:05 +00:00
|
|
|
plugins: [
|
2021-04-12 20:24:01 +00:00
|
|
|
{
|
2022-02-27 11:58:05 +00:00
|
|
|
// Set of built-in plugins enabled by default.
|
|
|
|
name: 'preset-default',
|
|
|
|
params: {
|
|
|
|
overrides: {
|
2023-06-15 15:29:13 +00:00
|
|
|
cleanupIds: false,
|
2022-02-27 11:58:05 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2021-04-12 20:24:01 +00:00
|
|
|
},
|
2022-02-27 11:58:05 +00:00
|
|
|
'removeRasterImages',
|
|
|
|
'sortAttrs'
|
|
|
|
],
|
|
|
|
// Set whitespace according to Wikimedia Coding Conventions.
|
2023-06-15 15:29:13 +00:00
|
|
|
// @see https://github.com/svg/svgo/blob/main/lib/stringifier.js#L39 for available options.
|
2021-04-12 20:24:01 +00:00
|
|
|
js2svg: {
|
2022-02-27 11:58:05 +00:00
|
|
|
eol: 'lf',
|
|
|
|
finalNewline: true,
|
|
|
|
// Configure the indent to tabs (default 4 spaces) used by `--pretty` here.
|
|
|
|
indent: '\t',
|
|
|
|
pretty: true
|
|
|
|
},
|
|
|
|
multipass: true
|
|
|
|
};
|