build: Update 'svgo' to latest v2.8.0 & re-crush images
Updating 'svgo' to v2.8.0 and newest Wikimedia SVG guidelines – mainly around new whitespace features of SVGO. Change-Id: I7c9eb84fdaeb50f6ff04c9e5cd2f005e129d555a
This commit is contained in:
@@ -1,55 +1,40 @@
|
||||
/**
|
||||
* SVGO Configuration
|
||||
* Compatible to v2.4.0+
|
||||
* Recommended options from:
|
||||
* https://www.mediawiki.org/wiki/Manual:Coding_conventions/SVG#Exemplified_safe_configuration
|
||||
*/
|
||||
const { extendDefaultPlugins } = require( 'svgo' );
|
||||
module.exports = {
|
||||
multipass: true,
|
||||
plugins: extendDefaultPlugins( [
|
||||
plugins: [
|
||||
{
|
||||
name: 'cleanupIDs',
|
||||
active: false
|
||||
// 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
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'removeDesc',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
name: 'removeRasterImages',
|
||||
active: true
|
||||
},
|
||||
{
|
||||
name: 'removeTitle',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
name: 'removeViewBox',
|
||||
active: 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
|
||||
name: 'removeXMLProcInst',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
name: 'sortAttrs',
|
||||
active: true
|
||||
}
|
||||
] ),
|
||||
|
||||
// Configure the indent (default 4 spaces) used by `--pretty` here:
|
||||
// @see https://github.com/svg/svgo/blob/master/lib/svgo/js2svg.js#L6 for more config options
|
||||
//
|
||||
// Unfortunately EOL cannot be configured, SVGO uses the platform's EOL marker.
|
||||
// On non-unix systems the linebreaks will be normalized to LF (unix) only at git commit,
|
||||
// assuming `core.autocrlf` is 'true' (default) or 'input'.
|
||||
'removeRasterImages',
|
||||
'sortAttrs'
|
||||
],
|
||||
// Set whitespace according to Wikimedia Coding Conventions.
|
||||
// @see https://github.com/svg/svgo/blob/v2.8.0/lib/stringifier.js#L41 for available options.
|
||||
js2svg: {
|
||||
indent: "\t",
|
||||
pretty: true,
|
||||
}
|
||||
}
|
||||
eol: 'lf',
|
||||
finalNewline: true,
|
||||
// Configure the indent to tabs (default 4 spaces) used by `--pretty` here.
|
||||
indent: '\t',
|
||||
pretty: true
|
||||
},
|
||||
multipass: true
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user