This repository has been archived by the owner on Apr 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathGruntfile.js
68 lines (65 loc) · 1.87 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* Initialize Grunt config.
* @param {Object} grunt
* @param {Function} grunt.initConfig
* @param {Function} grunt.loadNpmTasks
* @param {Function} grunt.registerTask
*/
function initGruntConfig(grunt) {
'use strict';
grunt.initConfig(
{
jshint: {
options: {
esversion: 6
},
js: {
src: 'js/*.js'
},
meta: {
src: '*.js'
},
tests: {
src: 'tests/*.js'
}
},
csslint: {
css: {
src: ['css/*.css']
}
},
fixpack: {
package: {
src: 'package.json'
}
},
watch: {
js: {
files: ['js/*.js'],
tasks: ['webpack']
},
css: {
files: ['css/*.css'],
tasks: ['webpack']
}
},
webpack: {
prod: require('./webpack.config.js'),
dev: Object.assign({watch: true, optimization: {minimize: false}}, require('./webpack.config.js'))
},
qunit: {
files: ['tests/index.html']
}
}
);
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-fixpack');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.registerTask('lint', ['jshint', 'fixpack', 'csslint']);
grunt.registerTask('default', ['webpack:prod']);
grunt.registerTask('watch', ['webpack:dev']);
grunt.registerTask('test', ['qunit']);
}
module.exports = initGruntConfig;