-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
135 lines (122 loc) · 4.27 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/**
*
* @authors Your Name (you@example.org)
* @date 2015-01-21 13:32:54
* @version $Id$
*/
module.exports = function(grunt) {
//配置参数
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
srcfiles:[
'src/emap/emap.js',
'src/emap/base/emap.lnglat.js',
'src/emap/base/emap.extent.js',
'src/emap/base/emap.bounds.js',
'src/emap/common/emap.tool.js',
'src/emap/common/emap.icon.js',
'src/emap/control/emap.control.maptypecontrol.js',
'src/emap/control/emap.control.js',
'src/emap/layers/baselayers/tile/source/emap.baselayer.emaparcgissource.js',
'src/emap/layers/baselayers/tile/emap.baselayer.tile.js',
'src/emap/layers/baselayers/tile/emap.baselayer.emapplanetile.js',
'src/emap/layers/baselayers/tile/emap.baselayer.emapsatellitetile.js',
'src/emap/layers/baselayers/tile/emap.baselayer.wmts.emapplanetile.js',
'src/emap/layers/baselayers/tile/emap.baselayer.wmts.emapsatellitetile.js',
'src/emap/layers/baselayers/emap.baselayers.manager.js',
'src/emap/layers/feature/emap.layer.vector.js',
'src/emap/feature/emap.feature.marker.js',
'src/emap/feature/emap.feature.polyline.js',
'src/emap/feature/emap.feature.polygon.js',
'src/emap/feature/emap.feature.circle.js',
'src/emap/feature/draw/emap.feature.drawpolyline.js',
'src/emap/feature/draw/emap.feature.drawpolygon.js',
'src/emap/feature/draw/emap.feature.drawrect.js',
'src/emap/feature/draw/emap.feature.drawcircle.js',
'src/emap/overlay/emap.overlay.marker.js',
'src/emap/overlay/emap.overlay.labelmarker.js',
'src/emap/overlay/emap.overlay.popuwindow.js',
'src/emap/events/emap.eventtype.js',
'src/emap/emap.map.js',
'src/emap/base/emap.bounds.js'
],
clean: {//清除目录
all: ['dest/**']
},
copy: {//复制文件
image: {
files: [
{expand: true, cwd: 'images', src: ['*.{png,jpg,jpeg,gif}'], dest: 'dest/images'}
]
}
},
concat: {//合并文件
options: {
separator: ';',
stripBanners: true
},
dest: {
src: '<%= srcfiles %>',
dest: "dest/<%= pkg.name %>.js"
}
},
concat_css: {//合并css
options: {},
all: {
src: ["css/*.css"],
dest: "dest/<%= pkg.name %>.css"
},
},
uglify: {//压缩插件
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: '<%= srcfiles %>',
dest: 'dest/<%= pkg.name %>.min.js'
}
},
cssmin: {//css压缩
options: {
keepSpecialComments: 0
},
compress: {
files: {
'dest/<%= pkg.name %>.min.css': [
"css/*.css"
]
}
}
},
jshint: {//js检查
files: ['Gruntfile.js', 'src/**/*.js'],
options: {
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
}
});
//载入concat和uglify插件,分别对于合并和压缩
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-concat-css');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-cssmin');
//注册任务
grunt.registerTask('default', [
'clean',
'copy',
//'jshint',
'concat',
'concat_css',
'uglify',
'cssmin'
]);
}