mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-28 01:50:09 +00:00
3205e72ad8
Replacing 'grunt-svgmin' with 'svgo' v2.3.0. Also - replacing all Grunt based tasks with npm equivalents. 'build' has before just been for SVG minification and that's the same now in npm. - changing to JS based '.svgo.config.js' - re-crushing all SVGs. Note that 'link-hover.svg' and 'link.svg' have been optimized with reduced precision. All other changes are resulting from updated SVGO. Bug: T278656 Change-Id: Ie895edb4e88336ffc56f570b8f80bf7d1e331894
71 lines
1.3 KiB
JavaScript
71 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-stylelint' );
|
|
|
|
grunt.initConfig( {
|
|
banana: conf.MessagesDirs,
|
|
eslint: {
|
|
options: {
|
|
cache: true,
|
|
fix: grunt.option( 'fix' )
|
|
},
|
|
all: [
|
|
'**/*.{js,json}',
|
|
'!{vendor,node_modules,docs}/**'
|
|
]
|
|
},
|
|
stylelint: {
|
|
options: {
|
|
fix: grunt.option( 'fix' )
|
|
},
|
|
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( 'test', 'lint' );
|
|
grunt.registerTask( 'default', [ 'test' ] );
|
|
};
|