mediawiki-extensions-Echo/Gruntfile.js
Volker E b3b9720733 build: Extend 'svgmin' options and move to 'minify' task
Also re-crush all SVGs.

Bug: T185596
Change-Id: I9f2be4b1b5c4c0597d4040250d87c939567cb83b
2018-05-29 10:26:22 -07:00

92 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* eslint-env node */
module.exports = function ( grunt ) {
var conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-svgmin' );
grunt.initConfig( {
eslint: {
src: [
'**/*.js',
'!node_modules/**',
'!vendor/**',
'!tests/externals/**',
'!docs/**'
]
},
// Lint Styling
stylelint: {
options: {
syntax: 'less'
},
all: [
'modules/**/*.css',
'modules/**/*.less'
]
},
// SVG Optimization
svgmin: {
options: {
js2svg: {
indent: ' ',
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/icons',
src: [
'**/*.svg'
],
dest: 'modules/icons/',
ext: '.svg'
} ]
}
},
banana: conf.MessagesDirs,
watch: {
files: [
'.{stylelintrc,eslintrc}.json',
'<%= eslint.all %>',
'<%= stylelint.all %>'
],
tasks: 'test'
},
jsonlint: {
all: [
'**/*.json',
'!node_modules/**',
'!vendor/**',
'!docs/**'
]
}
} );
grunt.registerTask( 'minify', 'svgmin' );
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] );
grunt.registerTask( 'test', 'lint' );
grunt.registerTask( 'default', [ 'minify', 'test' ] );
};