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' );
|
2015-06-20 04:55:50 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
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,
|
2015-06-20 04:55:50 +00:00
|
|
|
jsonlint: {
|
|
|
|
all: [
|
|
|
|
'**/*.json',
|
2017-11-11 23:25:39 +00:00
|
|
|
'!node_modules/**',
|
|
|
|
'!vendor/**'
|
2015-06-20 04:55:50 +00:00
|
|
|
]
|
2016-07-18 13:49:27 +00:00
|
|
|
},
|
2016-12-14 13:09:10 +00:00
|
|
|
eslint: {
|
2016-07-18 13:49:27 +00:00
|
|
|
all: [
|
|
|
|
'*.js',
|
|
|
|
'resources/mmv/**/*.js',
|
|
|
|
'tests/**/*.js'
|
|
|
|
]
|
|
|
|
},
|
2016-07-18 14:24:02 +00:00
|
|
|
stylelint: {
|
|
|
|
options: {
|
|
|
|
syntax: 'less'
|
|
|
|
},
|
|
|
|
src: 'resources/mmv/**/*.{css,less}'
|
2018-01-23 20:00:13 +00:00
|
|
|
},
|
|
|
|
// 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'
|
|
|
|
} ]
|
|
|
|
}
|
2015-06-20 04:55:50 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2018-01-23 20:00:13 +00:00
|
|
|
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'svgmin', 'jsonlint', 'banana' ] );
|
2015-06-20 04:55:50 +00:00
|
|
|
grunt.registerTask( 'default', 'test' );
|
|
|
|
};
|