2016-11-18 21:16:43 +00:00
|
|
|
|
/* eslint-env node */
|
2015-05-02 03:31:16 +00:00
|
|
|
|
module.exports = function ( grunt ) {
|
2017-01-23 13:40:14 +00:00
|
|
|
|
var conf = grunt.file.readJSON( 'extension.json' );
|
|
|
|
|
|
2016-11-18 21:16:43 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
2015-05-02 03:31:16 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
2016-11-18 21:16:43 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
2015-06-12 04:32:18 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
2016-10-05 00:11:41 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
2018-02-03 04:46:41 +00:00
|
|
|
|
grunt.loadNpmTasks( 'grunt-svgmin' );
|
2015-05-02 03:31:16 +00:00
|
|
|
|
|
|
|
|
|
grunt.initConfig( {
|
2016-11-18 21:16:43 +00:00
|
|
|
|
eslint: {
|
|
|
|
|
src: [
|
2015-10-31 12:35:06 +00:00
|
|
|
|
'**/*.js',
|
2016-05-16 20:59:43 +00:00
|
|
|
|
'!node_modules/**',
|
2016-11-18 21:16:43 +00:00
|
|
|
|
'!vendor/**',
|
2016-05-16 20:59:43 +00:00
|
|
|
|
'!tests/externals/**',
|
|
|
|
|
'!docs/**'
|
2015-10-31 12:35:06 +00:00
|
|
|
|
]
|
2015-05-02 03:31:16 +00:00
|
|
|
|
},
|
2016-10-05 00:11:41 +00:00
|
|
|
|
// Lint – Styling
|
|
|
|
|
stylelint: {
|
|
|
|
|
options: {
|
|
|
|
|
syntax: 'less'
|
|
|
|
|
},
|
|
|
|
|
all: [
|
|
|
|
|
'modules/**/*.css',
|
|
|
|
|
'modules/**/*.less'
|
|
|
|
|
]
|
|
|
|
|
},
|
2018-02-03 04:46:41 +00:00
|
|
|
|
// SVG Optimization
|
|
|
|
|
svgmin: {
|
|
|
|
|
options: {
|
|
|
|
|
js2svg: {
|
2018-03-26 07:49:43 +00:00
|
|
|
|
indent: ' ',
|
2018-02-03 04:46:41 +00:00
|
|
|
|
pretty: 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'
|
|
|
|
|
} ]
|
|
|
|
|
}
|
|
|
|
|
},
|
2017-01-23 13:40:14 +00:00
|
|
|
|
banana: conf.MessagesDirs,
|
2015-05-02 03:31:16 +00:00
|
|
|
|
watch: {
|
|
|
|
|
files: [
|
2017-08-19 07:44:03 +00:00
|
|
|
|
'.{stylelintrc,eslintrc}.json',
|
2016-11-18 21:16:43 +00:00
|
|
|
|
'<%= eslint.all %>',
|
|
|
|
|
'<%= stylelint.all %>'
|
2015-05-02 03:31:16 +00:00
|
|
|
|
],
|
|
|
|
|
tasks: 'test'
|
2015-06-12 04:32:18 +00:00
|
|
|
|
},
|
|
|
|
|
jsonlint: {
|
|
|
|
|
all: [
|
|
|
|
|
'**/*.json',
|
2016-05-16 20:59:43 +00:00
|
|
|
|
'!node_modules/**',
|
2017-11-07 18:26:19 +00:00
|
|
|
|
'!vendor/**',
|
2016-05-16 20:59:43 +00:00
|
|
|
|
'!docs/**'
|
2015-06-12 04:32:18 +00:00
|
|
|
|
]
|
2015-05-02 03:31:16 +00:00
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
|
2016-11-18 21:16:43 +00:00
|
|
|
|
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] );
|
2018-02-03 04:46:41 +00:00
|
|
|
|
grunt.registerTask( 'test', 'lint', 'svgmin' );
|
2015-05-02 03:31:16 +00:00
|
|
|
|
grunt.registerTask( 'default', 'test' );
|
|
|
|
|
};
|