forked from bilibili-helper/bilibili-helper-o
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
97 lines (94 loc) · 2.78 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
93
94
95
96
97
/* eslint-env node */
module.exports = function(grunt) {
grunt.loadNpmTasks('gruntify-eslint');
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
eslint: {
src: ['Gruntfile.js', 'src/**/*.js', '!src/**/*.min.js'],
},
babel: {
options: {
'sourceMap': false,
'presets': ['es2015'],
},
dist: {
files: [{
expand: true,
cwd: 'src',
src: ['**/*.js', '!**/*.min.js'],
ext: '.min.js',
dest: 'dest/',
}],
},
},
uglify: {
dist: {
options: {
sourceMap: false,
},
files: [{
expand: true,
src: ['dest/**/*.min.js'],
}],
},
},
htmlmin: {
main: {
options: {
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
},
files: [{
expand: true,
cwd: 'src',
src: ['**/*.html'],
dest: 'dest/',
ext: '.html',
}],
},
},
cssmin: {
main: {
options: {
shorthandCompacting: false,
roundingPrecision: -1,
},
files: [{
expand: true,
cwd: 'src',
src: ['**/*.css', '!**/*.min.css'],
dest: 'dest/',
ext: '.min.css',
}],
},
},
copy: {
main: {
files: [{
expand: true,
cwd: 'src',
src: ['**/**', '!**/*.html', '!**/*.js', '**/*.min.js', '!**/*.css', '**/*.min.css', '_locales/**'],
dest: 'dest/',
}],
},
},
compress: {
main: {
options: {
archive: 'bilibili_helper.zip',
},
files: [{
expand: true,
cwd: 'dest/',
src: ['**/*'],
dest: '/',
}],
},
},
});
grunt.registerTask('default', ['eslint', 'babel', 'uglify', 'htmlmin:main', 'cssmin:main', 'copy:main', 'compress:main']);
grunt.registerTask('debug', ['eslint', 'babel', 'htmlmin:main', 'cssmin:main', 'copy:main']);
};