diff --git a/Gruntfile.js b/Gruntfile.js index ef0c09a..3570388 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,7 @@ module.exports = function ( grunt ) { grunt.loadNpmTasks( 'grunt-banana-checker' ); grunt.loadNpmTasks( 'grunt-eslint' ); grunt.loadNpmTasks( 'grunt-stylelint' ); + grunt.loadNpmTasks( 'grunt-svgmin' ); grunt.initConfig( { eslint: { @@ -32,9 +33,46 @@ module.exports = function ( grunt ) { '!node_modules/**', '!vendor/**' ] + }, + // 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' + } ] + } } } ); + grunt.registerTask( 'minify', 'svgmin' ); grunt.registerTask( 'test', [ 'eslint', 'jsonlint', 'banana', 'stylelint' ] ); - grunt.registerTask( 'default', 'test' ); + grunt.registerTask( 'default', [ 'minify', 'test' ] ); }; diff --git a/package.json b/package.json index e5a2805..d6e942e 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "grunt-eslint": "21.0.0", "grunt-jsonlint": "1.1.0", "grunt-stylelint": "0.10.1", + "grunt-svgmin": "5.0.0", "stylelint-config-wikimedia": "0.5.0" } } diff --git a/resources/images/arrow-down-grey.svg b/resources/images/arrow-down-grey.svg index cd40af0..a44b024 100644 --- a/resources/images/arrow-down-grey.svg +++ b/resources/images/arrow-down-grey.svg @@ -1,55 +1,4 @@ - - - - - - image/svg+xml - - - - - - - - + + + diff --git a/resources/images/brackets-grey.svg b/resources/images/brackets-grey.svg index a5353a8..e0af334 100644 --- a/resources/images/brackets-grey.svg +++ b/resources/images/brackets-grey.svg @@ -1,47 +1,9 @@ - - - - - - - image/svg+xml - - - - - - - - - - - + + + + + + + + diff --git a/resources/images/cat-grey.svg b/resources/images/cat-grey.svg index 43f42d4..db7a2fe 100644 --- a/resources/images/cat-grey.svg +++ b/resources/images/cat-grey.svg @@ -1,234 +1,39 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/clock-grey.svg b/resources/images/clock-grey.svg index 9793049..d93dbc5 100644 --- a/resources/images/clock-grey.svg +++ b/resources/images/clock-grey.svg @@ -1,82 +1,7 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - + + + + + + diff --git a/resources/images/editing icons.svg b/resources/images/editing icons.svg index 0868f76..45d8cda 100644 --- a/resources/images/editing icons.svg +++ b/resources/images/editing icons.svg @@ -1,249 +1,35 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + A + + + + + + + + + diff --git a/resources/images/gear-grey.svg b/resources/images/gear-grey.svg index 46644ae..4db2d2d 100644 --- a/resources/images/gear-grey.svg +++ b/resources/images/gear-grey.svg @@ -1,35 +1,6 @@ - - - - - - - image/svg+xml - - - - - - - - + + + + + diff --git a/resources/images/gear-large-grey.svg b/resources/images/gear-large-grey.svg index e3a1eaf..b712be6 100644 --- a/resources/images/gear-large-grey.svg +++ b/resources/images/gear-large-grey.svg @@ -1,76 +1,4 @@ - - - - - - image/svg+xml - - - - - - - - - - + + + diff --git a/resources/images/languages-grey.svg b/resources/images/languages-grey.svg index 38cfd12..3f7cf4a 100644 --- a/resources/images/languages-grey.svg +++ b/resources/images/languages-grey.svg @@ -1,39 +1,7 @@ - - - - - - - image/svg+xml - - - - - - - - - + + + + + + diff --git a/resources/images/magnify-ltr.svg b/resources/images/magnify-ltr.svg index de54711..0173a53 100644 --- a/resources/images/magnify-ltr.svg +++ b/resources/images/magnify-ltr.svg @@ -1,84 +1,7 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - + + + + + + diff --git a/resources/images/magnify-rtl.svg b/resources/images/magnify-rtl.svg index 0beaf71..9b58195 100644 --- a/resources/images/magnify-rtl.svg +++ b/resources/images/magnify-rtl.svg @@ -1,86 +1,7 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - + + + + + + diff --git a/resources/images/menu-large-grey.svg b/resources/images/menu-large-grey.svg index ae4fa39..f37bb15 100644 --- a/resources/images/menu-large-grey.svg +++ b/resources/images/menu-large-grey.svg @@ -1,95 +1,6 @@ - - - - - - image/svg+xml - - - - - - - - - - - - + + + + + diff --git a/resources/images/page-grey.svg b/resources/images/page-grey.svg index d720150..a3f139d 100644 --- a/resources/images/page-grey.svg +++ b/resources/images/page-grey.svg @@ -1,35 +1,6 @@ - - - - - - - image/svg+xml - - - - - - - - + + + + + diff --git a/resources/images/pencil-grey.svg b/resources/images/pencil-grey.svg index 2e2eea7..af2b6ef 100644 --- a/resources/images/pencil-grey.svg +++ b/resources/images/pencil-grey.svg @@ -1,39 +1,7 @@ - - - - - - - image/svg+xml - - - - - - - - - + + + + + + diff --git a/resources/images/plus-grey.svg b/resources/images/plus-grey.svg index f586712..a3a3800 100644 --- a/resources/images/plus-grey.svg +++ b/resources/images/plus-grey.svg @@ -1,48 +1,7 @@ - - - - - - - image/svg+xml - - - - - - - - - + + + + + + diff --git a/resources/images/puzzle-grey.svg b/resources/images/puzzle-grey.svg index d44e80f..e4dc0b4 100644 --- a/resources/images/puzzle-grey.svg +++ b/resources/images/puzzle-grey.svg @@ -1,53 +1,9 @@ - - - - - - - image/svg+xml - - - - - - - - - - - + + + + + + + + diff --git a/resources/images/search-ltr.svg b/resources/images/search-ltr.svg index 009b5bb..2a560c3 100644 --- a/resources/images/search-ltr.svg +++ b/resources/images/search-ltr.svg @@ -1,44 +1,7 @@ - - - - - - - image/svg+xml - - - - - - - - - + + + + + + diff --git a/resources/images/search-rtl.svg b/resources/images/search-rtl.svg index 9b5c69a..f5c5bd3 100644 --- a/resources/images/search-rtl.svg +++ b/resources/images/search-rtl.svg @@ -1,44 +1,7 @@ - - - - - - - image/svg+xml - - - - - - - - - + + + + + + diff --git a/resources/images/star-filled.svg b/resources/images/star-filled.svg index 26f7923..d237685 100644 --- a/resources/images/star-filled.svg +++ b/resources/images/star-filled.svg @@ -1,6 +1,4 @@ - - - - - + + + diff --git a/resources/images/star.svg b/resources/images/star.svg index fa9642b..292f555 100644 --- a/resources/images/star.svg +++ b/resources/images/star.svg @@ -1,60 +1,6 @@ - - - - - - image/svg+xml - - - - - - - - - + + + + + diff --git a/resources/images/talk-grey.svg b/resources/images/talk-grey.svg index fdd1f74..e395801 100644 --- a/resources/images/talk-grey.svg +++ b/resources/images/talk-grey.svg @@ -1,77 +1,9 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - + + + + + + + + diff --git a/resources/images/user-grey.svg b/resources/images/user-grey.svg index e4e613c..c6be181 100644 --- a/resources/images/user-grey.svg +++ b/resources/images/user-grey.svg @@ -1,76 +1,5 @@ - - - - - - image/svg+xml - - - - - - - - - - - + + + + diff --git a/resources/images/user-large-grey.svg b/resources/images/user-large-grey.svg index 35033f5..c3b1acf 100644 --- a/resources/images/user-large-grey.svg +++ b/resources/images/user-large-grey.svg @@ -1,82 +1,5 @@ - - - - - - image/svg+xml - - - - - - - - - - - + + + +