forked from markmarkoh/datamaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
111 lines (106 loc) · 3.26 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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
replace: {
world: {
src: ['src/js/datamaps.js'],
dest: 'src/rel/datamaps.world.js',
replacements: [{
from: '\'__WORLD__\'',
to: '<%= grunt.file.read("src/js/data/world.topo.json") %>'
}]
},
worldHiRes: {
src: ['src/js/datamaps.js'],
dest: 'src/rel/datamaps.world.hires.js',
replacements: [{
from: '\'__WORLD__\'',
to: '<%= grunt.file.read("src/js/data/world.hires.topo.json") %>'
}]
},
usa: {
src: ['src/js/datamaps.js'],
dest: 'src/rel/datamaps.usa.js',
replacements: [{
from: '\'__USA__\'',
to: '<%= grunt.file.read("src/js/data/usa.topo.json") %>'
}]
},
all: {
src: ['src/js/datamaps.js'],
dest: 'src/rel/datamaps.all.js',
replacements: [{
from: '\'__USA__\'',
to: '<%= grunt.file.read("src/js/data/usa.topo.json") %>'
}, {
from: '\'__WORLD__\'',
to: '<%= grunt.file.read("src/js/data/world.topo.json") %>'
}]
},
allHiRes: {
src: ['src/js/datamaps.js'],
dest: 'src/rel/datamaps.all.hires.js',
replacements: [{
from: '\'__USA__\'',
to: '<%= grunt.file.read("src/js/data/usa.topo.json") %>'
}, {
from: '\'__WORLD__\'',
to: '<%= grunt.file.read("src/js/data/world.hires.topo.json") %>'
}]
}
},
watch: {
datamap: {
files: ['src/js/datamaps.js'],
tasks: ['replace'],
}
},
uglify: {
dist: {
files: {
'src/rel/datamaps.world.min.js': ['src/rel/datamaps.world.js'],
'src/rel/datamaps.world.hires.min.js': ['src/rel/datamaps.world.hires.js'],
'src/rel/datamaps.usa.min.js': ['src/rel/datamaps.usa.js'],
'src/rel/datamaps.all.min.js': ['src/rel/datamaps.all.js'],
'src/rel/datamaps.all.hires.min.js': ['src/rel/datamaps.all.hires.js'],
'src/rel/datamaps.none.min.js': ['src/js/datamaps.js']
}
}
},
jasmine: {
all: [
'src/tests/SpecRunner_StatesGlobal.html',
'src/tests/SpecRunner_StatesStripped.html',
'src/tests/SpecRunner_CountriesStripped.html',
'src/tests/SpecRunner_CountriesGlobal.html',
'src/tests/SpecRunner_AllStripped.html',
'src/tests/SpecRunner_AllGlobal.html',
'src/tests/SpecRunner_jQueryPlugin.html'
]
},
copy: {
all: {
files: [
{ src: ['src/rel/*.js'], dest: './dist', flatten: true, expand: true }
]
}
},
clean: {
release: ['.dist/datamaps.*.js']
},
sync: {
options: {
include: ['name', 'version', 'main', 'dependencies']
}
}
});
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sync-pkg');
grunt.registerTask('dev', ['replace']);
grunt.registerTask('build', ['replace', 'uglify:dist', 'copy', 'sync']);
};