-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgruntFile.js
More file actions
95 lines (94 loc) · 3.16 KB
/
gruntFile.js
File metadata and controls
95 lines (94 loc) · 3.16 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
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
src: ["client/app/*.js"]
},
uglify: {
options: {
mangle: false,
beautify: true
},
publish: {
files: {
"client/build/controllers.js": ["client/app/controllers/*.js", "client/app/services/*.js"]
}
}
},
express: {
options: {
// Override defaults here
},
dev: {
options: {
script: 'app.js'
}
}
},
compass: {
dist: {
options: {
sassDir: 'client/assets/sass',
cssDir: 'client/assets/css',
outputStyle:'expanded'
}
}
},
watch: {
livereload: {
options: {
livereload: true,
reload: true
},
files: ['client/**/*.html', 'client/app/**/*.js', 'client/assets/css/*.css']
},
express: {
files: ['app.js', 'service/*.js', 'service/**/*.js'],//监控express服务端代码。如有变更则重启服务器
tasks: ['express:dev'],
options: {
nospawn: true,
atBegin: true
}
},
concat: {
files: ["client/app/controllers/**/*.js", "client/app/services/*.js", "client/app/filters/*.js"],
tasks: ["concat"]
},
compass:{
files: ['client/assets/sass/*.scss'],
tasks:['compass:dist']
}
},
concat: {
options: {
separator: ';'
},
dist: {
src: ["client/app/controllers/**/*.js", "client/app/services/*.js", "client/app/filters/*.js"],
dest: 'client/build/controllers.js'
}
},
copy: {
main: {
files: [{ expand: true, cwd: 'server/', src: 'api/**', dest: 'dest/', filter: 'isFile' },
{ expand: true, cwd: 'server/', src: 'utils/**', dest: 'dest/', filter: 'isFile' },
{ expand: true, cwd: 'server/', src: ['config.db.js', 'config.js', 'config.publisher.router.js', 'db.js'], dest: 'dest/', filter: 'isFile' }
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
//文件合并
grunt.loadNpmTasks('grunt-contrib-concat');
//代码检查
grunt.loadNpmTasks('grunt-contrib-jshint');
//文件监视
grunt.loadNpmTasks('grunt-contrib-watch');
//文件压缩
grunt.loadNpmTasks('grunt-contrib-uglify');
//用于express服务重启
grunt.loadNpmTasks('grunt-express-server');
//加载compass插件
grunt.loadNpmTasks('grunt-contrib-compass');
};