mediawiki-extensions-Cite/Gruntfile.js
James D. Forrester dd87939792 build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlint
Bug: T220036
Change-Id: I279f56b251c53aa5deee74185ece69b2150509bb
2019-05-06 15:20:35 -07:00

78 lines
1.3 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-stylelint' );
grunt.loadNpmTasks( 'grunt-svgmin' );
grunt.initConfig( {
eslint: {
options: {
reportUnusedDisableDirectives: true,
extensions: [ '.js', '.json' ],
cache: true
},
all: [
'**/*.js{,on}',
'!{vendor,node_modules}/**'
]
},
banana: conf.MessagesDirs,
stylelint: {
all: [
'**/*.css',
'**/*.less',
'!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', 'banana', 'svgmin' ] );
grunt.registerTask( 'default', 'test' );
};