mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
c9403011c8
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 - don't use multipass. Also updating SVGs accordingly. Bug: T185596 Change-Id: I2288c7576ac96f8b5c4d5b8671218fceefaf6037
89 lines
1.6 KiB
JavaScript
89 lines
1.6 KiB
JavaScript
/* eslint-env node */
|
||
module.exports = function ( grunt ) {
|
||
var conf = grunt.file.readJSON( 'extension.json' );
|
||
|
||
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
||
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
||
grunt.loadNpmTasks( 'grunt-eslint' );
|
||
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
||
grunt.loadNpmTasks( 'grunt-stylelint' );
|
||
grunt.loadNpmTasks( 'grunt-svgmin' );
|
||
|
||
grunt.initConfig( {
|
||
eslint: {
|
||
src: [
|
||
'**/*.js',
|
||
'!node_modules/**',
|
||
'!vendor/**',
|
||
'!tests/externals/**',
|
||
'!docs/**'
|
||
]
|
||
},
|
||
// Lint – Styling
|
||
stylelint: {
|
||
options: {
|
||
syntax: 'less'
|
||
},
|
||
all: [
|
||
'modules/**/*.css',
|
||
'modules/**/*.less'
|
||
]
|
||
},
|
||
// SVG Optimization
|
||
svgmin: {
|
||
options: {
|
||
js2svg: {
|
||
pretty: true
|
||
},
|
||
plugins: [ {
|
||
cleanupIDs: false
|
||
}, {
|
||
removeDesc: false
|
||
}, {
|
||
removeRasterImages: true
|
||
}, {
|
||
removeTitle: false
|
||
}, {
|
||
removeViewBox: false
|
||
}, {
|
||
removeXMLProcInst: false
|
||
}, {
|
||
sortAttrs: true
|
||
} ]
|
||
},
|
||
all: {
|
||
files: [ {
|
||
expand: true,
|
||
cwd: 'modules/icons',
|
||
src: [
|
||
'**/*.svg'
|
||
],
|
||
dest: 'modules/icons/',
|
||
ext: '.svg'
|
||
} ]
|
||
}
|
||
},
|
||
banana: conf.MessagesDirs,
|
||
watch: {
|
||
files: [
|
||
'.{stylelintrc,eslintrc}.json',
|
||
'<%= eslint.all %>',
|
||
'<%= stylelint.all %>'
|
||
],
|
||
tasks: 'test'
|
||
},
|
||
jsonlint: {
|
||
all: [
|
||
'**/*.json',
|
||
'!node_modules/**',
|
||
'!vendor/**',
|
||
'!docs/**'
|
||
]
|
||
}
|
||
} );
|
||
|
||
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] );
|
||
grunt.registerTask( 'test', 'lint', 'svgmin' );
|
||
grunt.registerTask( 'default', 'test' );
|
||
};
|