mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-16 03:23:22 +00:00
e3007e9484
Enabling SVGO automation with 'grunt-svgmin' and conservative plugin settings to build step, among those: - enable removeRasterImages and sortAttrs, - disable cleanupIDs, removeDesc, removeTitle, removeViewBox & removeXMLProcInst and - make use of pretty and multipass options. Also updating SVGs accordingly. Bug: T185596 Change-Id: Iec947431b3549e9f1fa1eaba58340aef96c0647b
84 lines
1.4 KiB
JavaScript
84 lines
1.4 KiB
JavaScript
/*!
|
|
* Grunt file
|
|
*
|
|
* @package Cite
|
|
*/
|
|
|
|
/* eslint-env node, es6 */
|
|
|
|
module.exports = function ( grunt ) {
|
|
var conf = grunt.file.readJSON( 'extension.json' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
|
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
|
grunt.loadNpmTasks( 'grunt-svgmin' );
|
|
|
|
grunt.initConfig( {
|
|
eslint: {
|
|
all: [
|
|
'**/*.js',
|
|
'{.jsduck,build}/**/*.js',
|
|
'modules/**/*.js',
|
|
'!node_modules/**',
|
|
'!vendor/**'
|
|
]
|
|
},
|
|
banana: conf.MessagesDirs,
|
|
stylelint: {
|
|
all: [
|
|
'**/*.css',
|
|
'**/*.less',
|
|
'!node_modules/**',
|
|
'!vendor/**'
|
|
]
|
|
},
|
|
jsonlint: {
|
|
all: [
|
|
'**/*.json',
|
|
'!node_modules/**',
|
|
'!vendor/**'
|
|
]
|
|
},
|
|
// SVG Optimization
|
|
svgmin: {
|
|
options: {
|
|
js2svg: {
|
|
pretty: true,
|
|
multipass: true
|
|
},
|
|
plugins: [ {
|
|
cleanupIDs: false
|
|
}, {
|
|
removeDesc: false
|
|
}, {
|
|
removeRasterImages: true
|
|
}, {
|
|
removeTitle: false
|
|
}, {
|
|
removeViewBox: false
|
|
}, {
|
|
removeXMLProcInst: false
|
|
}, {
|
|
sortAttrs: true
|
|
} ]
|
|
},
|
|
all: {
|
|
files: [ {
|
|
expand: true,
|
|
cwd: 'modules/ve-cite/icons',
|
|
src: [
|
|
'**/*.svg'
|
|
],
|
|
dest: 'modules/ve-cite/icons/',
|
|
ext: '.svg'
|
|
} ]
|
|
}
|
|
}
|
|
} );
|
|
|
|
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'jsonlint', 'banana', 'svgmin' ] );
|
|
grunt.registerTask( 'default', 'test' );
|
|
};
|