mediawiki-extensions-Multim.../Gruntfile.js
James D. Forrester f7681dc537 Follow-up 950577662: Put developer-focussed notes in DEVELOPERS.md
Much more likely to be found than inline comments in Gruntfile.js.

Change-Id: I51f8b56d490fb72dba111d80140b4f3c6e87db18
2020-02-24 12:08:52 -08:00

76 lines
1.4 KiB
JavaScript

/* eslint-env node */
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( {
banana: conf.MessagesDirs,
eslint: {
options: {
extensions: [ '.js', '.json' ],
fix: grunt.option( 'fix' ),
cache: true
},
all: [
'**/*.{js,json}',
'!{vendor,node_modules,docs}/**'
]
},
stylelint: {
options: {
fix: grunt.option( 'fix' ),
syntax: 'less'
},
src: 'resources/mmv/**/*.{css,less}'
},
// Image 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',
src: [
'**/*.svg'
],
dest: 'resources/',
ext: '.svg'
} ]
}
}
} );
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'banana' ] );
grunt.registerTask( 'minify', 'svgmin' );
grunt.registerTask( 'test', 'lint' );
grunt.registerTask( 'build', 'minify' );
grunt.registerTask( 'default', [ 'test', 'build' ] );
};