-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
92 lines (90 loc) · 2.03 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* global module: true */
module.exports = function (grunt) {
grunt.initConfig({
htmlmin: {
options: {
collapseWhitespace: true,
preserveLineBreaks: false
},
files: {
expand: true,
src: ['*.html', 'labs/*.html'],
dest: 'dist/'
}
},
cssmin: {
files: {
expand: true,
src: ['labs/css/*.css'],
dest: 'dist/'
}
},
imagemin: {
files: {
expand: true,
src: ['labs/images/*.{png,jpg,gif}'],
dest: 'dist/'
}
},
terser: {
main: {
files: [{
expand: true,
src: ['labs/js/*.js'],
dest: 'dist/'
}]
}
},
copy: {
main: {
files: [
{
expand: true,
cwd: '03-third-part-widget',
src: 'mathquill/**',
dest: 'dist/03-third-part-widget/'
}
]
}
},
qiniu_qupload: {
default_options: {
options: {
ak: 'QINIU_AK',
sk: 'QINIU_SK',
bucket: 'app-info-lab',
assets: [{src: 'dist', prefix: ''}]
}
}
},
htmlhint: {
options: {
htmlhintrc: '.htmlhintrc'
},
src: ['*.html', 'labs/*.html']
},
csslint: {
options: {
csslintrc: '.csslintrc'
},
src: ['labs/css/*.css']
},
eslint: {
options: {
configFile: '.eslintrc.json'
},
target: ['./labs/js/*.js']
}
});
grunt.loadNpmTasks('grunt-terser');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('@wangding/grunt-qiniu-qupload');
grunt.loadNpmTasks('grunt-htmlhint');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('lint', ['htmlhint', 'csslint', 'eslint']);
grunt.registerTask('build', ['htmlmin', 'cssmin', 'terser']);
grunt.registerTask('upload', ['qiniu_qupload']);
};