-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
57 lines (51 loc) · 1.36 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
module.exports = function(grunt){
require('load-grunt-tasks')(grunt); //加载所有的任务
grunt.initConfig({
// package file
pkg: grunt.file.readJSON("package.json"),
// prefix 预处理部分,由于grunt-cover有错误,所以需要使用自带文件对其进行copy
copy: {
main: {
files: [
{expand: true, flatten: true, src: ['vendor/js/grunt-coverjs/*'], dest: 'node_modules/grunt-coverjs/tasks', filter: 'isFile'}
]
}
},
// public 发布版,压缩all.js和all.css
uglify:{
options: {
},
build: {
src: 'vendor/js/*.js',
dest:'vendor/js/dist/all.js'
}
},
cssmin: {
minify: {
src: 'vendor/css/*.css',
dest:'vendor/css/dist/all.css'
}
},
// 自动做插针合并以及监控代码
cover: {
compile: {
files: [{
'test/dist/test.js': ['src/*.js']
}]
}
},
watch: {
js: {
files: [
"src/*.js"
],
tasks: ['cover']
}
}
});
// author use
grunt.registerTask('public', ['uglify', 'cssmin']);
// user use
grunt.registerTask('preFix', ['copy']);
grunt.registerTask('default', ['cover', 'watch']);
};