forked from mapbox/makizushi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcache.js
26 lines (24 loc) · 824 Bytes
/
cache.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
var fs = require('fs'),
path = require('path');
// Loads up all default markers at require time.
module.exports = [
['base', 'base'],
['mask', 'mask'],
['alphanum', 'symbol']
].reduce(function(memo, destsrc) {
var dest = destsrc[1],
src = destsrc[0],
basepath = path.resolve(__dirname + '/markers-src/' + src);
memo[dest] = fs.readdirSync(basepath)
.sort()
.reduce(function(memo, file) {
if (path.extname(file) !== '.png') return memo;
var key = path.basename(file, '.png')
.replace('-12', '-s')
.replace('-18', '-m')
.replace('-24', '-l');
memo[key] = fs.readFileSync(basepath + '/' + file);
return memo;
}, memo[dest] || {});
return memo;
}, { url: {} });