2016-12-14 13:09:10 +00:00
|
|
|
/* eslint-env node */
|
|
|
|
|
2015-06-20 04:55:50 +00:00
|
|
|
module.exports = function ( grunt ) {
|
2017-01-23 13:51:12 +00:00
|
|
|
var conf = grunt.file.readJSON( 'extension.json' );
|
|
|
|
|
2015-06-20 04:55:50 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
2016-12-14 13:09:10 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
2016-07-18 14:24:02 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
2018-01-23 20:00:13 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-svgmin' );
|
2015-06-20 04:55:50 +00:00
|
|
|
|
|
|
|
grunt.initConfig( {
|
2017-01-23 13:51:12 +00:00
|
|
|
banana: conf.MessagesDirs,
|
2016-12-14 13:09:10 +00:00
|
|
|
eslint: {
|
2019-02-06 01:56:53 +00:00
|
|
|
options: {
|
2020-06-26 10:45:20 +00:00
|
|
|
cache: true,
|
|
|
|
fix: grunt.option( 'fix' )
|
2019-02-06 01:56:53 +00:00
|
|
|
},
|
2016-07-18 13:49:27 +00:00
|
|
|
all: [
|
2019-07-29 14:20:17 +00:00
|
|
|
'**/*.{js,json}',
|
|
|
|
'!{vendor,node_modules,docs}/**'
|
2016-07-18 13:49:27 +00:00
|
|
|
]
|
|
|
|
},
|
2016-07-18 14:24:02 +00:00
|
|
|
stylelint: {
|
|
|
|
options: {
|
2020-06-26 10:45:20 +00:00
|
|
|
fix: grunt.option( 'fix' )
|
2016-07-18 14:24:02 +00:00
|
|
|
},
|
|
|
|
src: 'resources/mmv/**/*.{css,less}'
|
2018-01-23 20:00:13 +00:00
|
|
|
},
|
|
|
|
// Image Optimization
|
|
|
|
svgmin: {
|
|
|
|
options: {
|
|
|
|
js2svg: {
|
2019-02-07 04:54:44 +00:00
|
|
|
indent: '\t',
|
2018-01-23 20:00:13 +00:00
|
|
|
pretty: true
|
|
|
|
},
|
2018-11-29 02:32:16 +00:00
|
|
|
multipass: true,
|
2018-01-23 20:00:13 +00:00
|
|
|
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'
|
|
|
|
} ]
|
|
|
|
}
|
2015-06-20 04:55:50 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2020-02-24 13:55:54 +00:00
|
|
|
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'banana' ] );
|
|
|
|
grunt.registerTask( 'minify', 'svgmin' );
|
|
|
|
|
|
|
|
grunt.registerTask( 'test', 'lint' );
|
|
|
|
grunt.registerTask( 'build', 'minify' );
|
|
|
|
grunt.registerTask( 'default', [ 'test', 'build' ] );
|
2015-06-20 04:55:50 +00:00
|
|
|
};
|