-
Notifications
You must be signed in to change notification settings - Fork 5
/
Gruntfile.js
43 lines (40 loc) · 1014 Bytes
/
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
'use strict';
var _ = require('lodash'),
loader = require('csv-load-sync');
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('./package.json'),
'string-replace': {
inline: {
files: {
'build/': '<%= pkg.name %>.js'
}
},
options: {
replacements: [
{
pattern: 'var zones = [];',
replacement: 'var zones = ' + JSON.stringify(loader('./data/zone.csv')) + ';'
}
]
}
},
uglify: {
dist: {
files: {
'dist/<%= pkg.name %>.min.js': 'build/<%= pkg.name %>.js'
}
}
},
copy: {
dist: {
src: 'build/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-string-replace');
grunt.registerTask('default', ['string-replace:inline', 'uglify:dist', 'copy:dist']);
};