mediawiki-extensions-Multim.../Gruntfile.js
Volker E d1f416278a Bring SVGO optimization to build step
Enabling SVGO automation with conservative plugin set, among those:
- disable cleanupIDs, removeDesc, removeTitle, removeViewBox &
  removeXMLProcInst and
- don't use multipass,
- enable removeRasterImages and sortAttrs

Bug: T185596
Change-Id: Ic13afb6e1cbc4d26af7a100cb7a916619fb4158e
2018-01-24 00:27:53 -08:00

73 lines
1.3 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-jsonlint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-svgmin' );
grunt.initConfig( {
banana: conf.MessagesDirs,
jsonlint: {
all: [
'**/*.json',
'!node_modules/**',
'!vendor/**'
]
},
eslint: {
all: [
'*.js',
'resources/mmv/**/*.js',
'tests/**/*.js'
]
},
stylelint: {
options: {
syntax: 'less'
},
src: 'resources/mmv/**/*.{css,less}'
},
// Image 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: 'resources',
src: [
'**/*.svg'
],
dest: 'resources/',
ext: '.svg'
} ]
}
}
} );
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'svgmin', 'jsonlint', 'banana' ] );
grunt.registerTask( 'default', 'test' );
};