mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-15 20:09:22 +00:00
d1f416278a
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
73 lines
1.3 KiB
JavaScript
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' );
|
|
};
|