-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
90 lines (74 loc) · 3.29 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
var path=require('path');
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
jquery: { expand: true,
flatten: true,
cwd: 'bower_components',
src: ['jquery/dist/jquery.js'],
dest: 'src/main/webapp/js-lib/jquery',
filter: 'isFile'},
bootstrap: { expand: true,
flatten: false,
cwd: 'bower_components/bootstrap/dist',
src: ['js/bootstrap.js',
'css/bootstrap.css',
'fonts/glyphicons-halflings-regular.eot',
'fonts/glyphicons-halflings-regular.svg',
'fonts/glyphicons-halflings-regular.ttf',
'fonts/glyphicons-halflings-regular.woff',
'fonts/glyphicons-halflings-regular.woff2'],
dest: 'src/main/webapp/js-lib/bootstrap',
filter: 'isFile'},
datatables: { expand: true,
flatten: false,
cwd: 'bower_components/datatables/media',
src: ['js/jquery.dataTables.js',
'css/jquery.dataTables.css',
'images/sort_asc_disabled.png',
'images/sort_asc.png',
'images/sort_both.png',
'images/sort_desc_disabled.png',
'images/sort_desc.png'],
dest: 'src/main/webapp/js-lib/datatables',
filter: 'isFile'},
easyui: { expand: true,
flatten: false,
cwd: 'bower_components/jquery-easyui-bower',
src: ['jquery.easyui.min.js',
'themes/**',
'locale/*'],
dest: 'src/main/webapp/js-lib/easyui',
filter: 'isFile'}
},
clean: {
preBuild: {
src: ["src/main/webapp/js-lib"]
}
}
});
grunt.event.on('watch', function(action, filepath, target) {
if(target==='html') {
grunt.log.writeln(filepath.substring(4,filepath.length));
grunt.config('copy.html.src', filepath.substring(4,filepath.length));
}
if(target==='css') {
grunt.log.writeln(filepath.substring("app/styles/".length,filepath.length));
grunt.config('copy.css.src', filepath.substring("app/styles/".length,filepath.length));
}
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
// 加载包含 "copy" 任务的插件。
grunt.loadNpmTasks('grunt-contrib-copy');
// 加载包含 "concat" 任务的插件。
grunt.loadNpmTasks('grunt-contrib-concat');
// 加载包含 "clean" 任务的插件。
grunt.loadNpmTasks('grunt-contrib-clean');
// 加载包含 "watch" 任务的插件。
grunt.loadNpmTasks('grunt-contrib-watch');
// 默认被执行的任务列表。
grunt.registerTask('default', []);
grunt.registerTask('all', ['clean','copy']);
};