-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGruntfile.js
More file actions
113 lines (96 loc) · 3.32 KB
/
Gruntfile.js
File metadata and controls
113 lines (96 loc) · 3.32 KB
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
98
99
100
101
102
103
104
105
106
107
108
module.exports = function(grunt){
// 项目配置
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//合并任务
concat: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
"we_min": {
src: ['public/js/src/we.min/we.js','public/js/src/we.min/*.js','public/js/src/we.ui/we.dialog.js','public/js/src/we.api/*.js'],
dest: 'public/js/lib/we.min.js'
},
"we_chat_min": {
src: ['public/js/src/we.chat/we.page.chat.js'],
dest: 'public/js/chat.min.js'
},
"we_create_min": {
src: ['public/js/src/we.create/we.create.js'],
dest: 'public/js/we.create.min.js'
},
"we_top_min": {
src: ['public/js/src/we.top/we.top.js'],
dest: 'public/js/we.top.min.js'
},
"we_user_min": {
src: ['public/js/src/we.user/we.page.user.js'],
dest: 'public/js/we.user.min.js'
},
"chat":{
src:['public/js/chat.js'],
dest: 'public/js/chat.min.js'
}
},
//压缩任务
uglify:{
options:{
banner:'/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd hh:MM:ss") %> */\n'
},
"we_min":{
files:{"<%= concat.we_min.dest %>":['<%= concat.we_min.src %>']}
},
"we_chat_min": {
files:{"<%= concat.we_chat_min.dest %>":['<%= concat.we_chat_min.src %>']}
},
"we_create_min": {
files:{"<%= concat.we_create_min.dest %>":['<%= concat.we_create_min.src %>']}
},
"we_top_min": {
files:{"<%= concat.we_top_min.dest %>":['<%= concat.we_top_min.src %>']}
},
"we_user_min": {
files:{"<%= concat.we_user_min.dest %>":['<%= concat.we_user_min.src %>']}
},
"chat": {
files:{"<%= concat.chat.dest %>":['<%= concat.chat.src %>']}
}
},
watch: {
"we_min":{
files: ["<%= concat.we_min.src %>"],
tasks: ['concat:we_min']
},
"we_chat_min":{
files: ["<%= concat.we_chat_min.src %>"],
tasks: ['concat:we_chat_min']
},
"we_create_min":{
files: ["<%= concat.we_create_min.src %>"],
tasks: ['concat:we_create_min']
},
"we_top_min":{
files: ["<%= concat.we_top_min.src %>"],
tasks: ['concat:we_top_min']
},
"we_user_min":{
files: ["<%= concat.we_user_min.src %>"],
tasks: ['concat:we_user_min']
},
"chat": {
files: ["<%= concat.chat.src %>"],
tasks: ['concat:chat']
}
}
});
// 加载提供"uglify"任务的插件
grunt.loadNpmTasks('grunt-contrib-concat');
//合并插件
grunt.loadNpmTasks('grunt-contrib-uglify');
//合并插件
grunt.loadNpmTasks('grunt-contrib-watch');
//上线 grunt
grunt.registerTask('default', ['uglify']);
//开发 grunt dev
grunt.registerTask('dev', ['concat','watch']);
}