This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Replace 'grunt-svgmin' with npm based 'svgo'
Replacing 'grunt-svgmin' with 'svgo' v2.8.0. Also - replacing Grunt based task with npm equivalent including excluded SVG file. - changing to JS based '.svgo.config.js' Bug: [T246321](https://phabricator.wikimedia.org/T246321) Bug: [T278656](https://phabricator.wikimedia.org/T278656)
- Loading branch information
Showing
4 changed files
with
80 additions
and
608 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.