-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
119 lines (114 loc) · 4.2 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
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
main: {
expand: true,
cwd: 'bower_components/',
src: [
'leaflet-control-osm-geocoder/images/*',
'leaflet-fullscreen/*.png',
'leaflet/dist/images/*'
],
dest: 'icons/',
flatten: true,
filter: 'isFile'
},
demo: {
expand: true,
cwd: '.',
src: [
'<%= pkg.name %>.lib.min.js',
'<%= pkg.name %>.min.js',
'<%= pkg.name %>.js',
'<%= pkg.name %>.min.css',
'icons/*'
],
dest: 'demo/'
}
},
concat: {
options: {
// define a string to put between each file in the concatenated output
separator: ';'
},
lib: {
// the files to concatenate
src: '<%= pkg.files %>',
// the location of the resulting JS file
dest: '<%= pkg.name %>.lib.js'
},
main: {
src: [
'js/<%= pkg.name %>.datasources.js',
'js/<%= pkg.name %>.datatypes.js',
'js/<%= pkg.name %>.geosources.js',
'js/<%= pkg.name %>.geotypes.js',
'js/<%= pkg.name %>.views.js',
'js/<%= pkg.name %>.main.js'
],
dest: '<%= pkg.name %>.js'
}
},
uglify: {
options: {
// the banner is inserted at the top of the output
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
'<%= pkg.name %>.lib.min.js': ['<%= concat.lib.dest %>'],
'<%= pkg.name %>.min.js': ['<%= pkg.name %>.js']
}
}
},
cssmin: {
options: {
keepSpecialComments: false,
target: '.'
},
combine: {
files: {
'<%= pkg.name %>.min.css': [
'bower_components/leaflet/dist/leaflet.css',
'bower_components/leaflet-control-osm-geocoder/Control.OSMGeocoder.css',
'bower_components/Leaflet.label/dist/leaflet.label.css',
'bower_components/leaflet-fullscreen/Control.FullScreen.css',
'bower_components/leaflet.markercluster/dist/MarkerCluster.Default.css',
'bower_components/leaflet.markercluster/dist/MarkerCluster.css',
'css/main.css',
'css/layout.css',
'css/table.css'
]
}
}
},
'string-replace': {
dist: {
files: {
'<%= pkg.name %>.min.css': '<%= pkg.name %>.min.css'
},
options: {
replacements: [{
pattern: /url\(([^#\)]*\/)([^\/\)#]*)\)/g,
replacement: 'url(icons/$2)'
}]
}
}
},
jshint: {
// define the files to lint
files: ['Gruntfile.js', 'js/**/*.js', '<%= pkg.name %>.js'],
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('jshint', ['jshint']);
grunt.registerTask('default', [/*'jshint',*/ 'copy:main', 'concat', 'uglify', 'cssmin', 'string-replace', 'copy:demo']);
grunt.registerTask('test', [/*'jshint',*/ 'copy:main', 'concat', 'cssmin', 'string-replace', 'copy:demo']);
}