build: Update SVGO to latest v2.3.0 and re-optimize SVGs

SVGO v2.x changed configuration to JS, amending configuration.
Adding new 'minify-svg' npm script.
Also re-optimize SVGs.

Bug: T278656
Change-Id: I88ebed650be0d20b71bca6f15f3aa70b6b5eb42a
This commit is contained in:
Volker E
2021-05-18 04:17:32 -07:00
committed by James D. Forrester
parent 4afb27e85d
commit 8354e280b6
8 changed files with 818 additions and 1597 deletions

View File

@@ -5,7 +5,6 @@ module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-svgmin' );
grunt.initConfig( {
eslint: {
@@ -29,46 +28,9 @@ module.exports = function ( grunt ) {
'!vendor/**'
]
},
banana: conf.MessagesDirs,
// SVG Optimization
svgmin: {
options: {
js2svg: {
indent: '\t',
pretty: true
},
multipass: true,
plugins: [ {
cleanupIDs: false
}, {
removeDesc: false
}, {
removeRasterImages: true
}, {
removeTitle: false
}, {
removeViewBox: false
}, {
removeXMLProcInst: false
}, {
sortAttrs: true
} ]
},
all: {
files: [ {
expand: true,
cwd: 'resources/images',
src: [
'**/*.svg'
],
dest: 'resources/images/',
ext: '.svg'
} ]
}
}
banana: conf.MessagesDirs
} );
grunt.registerTask( 'minify', 'svgmin' );
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'banana' ] );
grunt.registerTask( 'default', [ 'minify', 'test' ] );
grunt.registerTask( 'default', [ 'test' ] );
};