-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathGruntfile.js
78 lines (54 loc) · 1.45 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
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
// 加载项目配置
var configApp = require('./config/config');
// 路径配置
var appConfig = configApp.path;
// grunt配置
var config = {
// 路径配置
yo: appConfig,
clean: require('./config/grunt/clean'),
copy: require('./config/grunt/copy'),
postcss: require('./config/grunt/postcss'),
cssmin: require('./config/grunt/cssmin'),
useminPrepare: require('./config/grunt/usemin-prepare'),
usemin: require('./config/grunt/usemin')(),
sprite: require('./config/grunt/sprite'),
filerev: require('./config/grunt/filerev'),
nodemon: require('./config/grunt/nodemon')(),
concurrent: require('./config/grunt/concurrent'),
htmlclean: require('./config/grunt/htmlclean'),
browserSync: require('./config/grunt/browserSync'),
cdn: require('./config/grunt/cdn')()
};
//加载grunt
grunt.initConfig(config);
// 注册代码编译任务
grunt.registerTask('build', [
'clean:dist',
'concurrent:copy',
'useminPrepare',
'postcss',
'concat',
'uglify',
'cssmin',
'filerev',
'copy:html',
'usemin',
'htmlclean',
'concurrent:clean'
]);
grunt.registerTask('buildCdn', [
'build',
'cdn'
]);
// 注册Grunt默认任务
grunt.registerTask('default', [
'nodemon'
]);
grunt.registerTask('serve', [
'browserSync'
]);
};