Parser::extensionSubstitution() Don't run substr() on null
[mediawiki.git] / .svgo.config.js
blob492f6874545abafe041b3319a0a1790145fba866
1 /**
2  * SVGO Configuration
3  * Compatible to v2.4.0+
4  * Recommended options from:
5  * https://www.mediawiki.org/wiki/Manual:Coding_conventions/SVG#Exemplified_safe_configuration
6  */
7 module.exports = {
8         plugins: [
9                 {
10                         // Set of built-in plugins enabled by default.
11                         name: 'preset-default',
12                         params: {
13                                 overrides: {
14                                         cleanupIDs: false,
15                                         removeDesc: false,
16                                         removeTitle: false,
17                                         removeViewBox: false,
18                                         // If the SVG doesn't start with an XML declaration, then its MIME type will
19                                         // be detected as "text/plain" rather than "image/svg+xml" by libmagic and,
20                                         // consequently, MediaWiki's CSSMin CSS minifier. libmagic's default database
21                                         // currently requires that SVGs contain an XML declaration:
22                                         // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/sgml#L5
23                                         removeXMLProcInst: false
24                                 }
25                         }
26                 },
27                 'removeRasterImages',
28                 'sortAttrs'
29         ],
30         // Set whitespace according to Wikimedia Coding Conventions.
31         // @see https://github.com/svg/svgo/blob/v2.8.0/lib/stringifier.js#L41 for available options.
32         js2svg: {
33                 eol: 'lf',
34                 finalNewline: true,
35                 // Configure the indent to tabs (default 4 spaces) used by `--pretty` here.
36                 indent: '\t',
37                 pretty: true
38         },
39         multipass: true