Serve fonts
This commit is contained in:
+15
-1
@@ -7,7 +7,7 @@ var clone = require('clone'),
|
||||
express = require('express');
|
||||
|
||||
|
||||
module.exports = function(repo, options, id, reportVector) {
|
||||
module.exports = function(repo, options, id, reportVector, reportFont) {
|
||||
var app = express().disable('x-powered-by');
|
||||
|
||||
var rootPath = path.join(process.cwd(), options.root || '');
|
||||
@@ -25,6 +25,20 @@ module.exports = function(repo, options, id, reportVector) {
|
||||
}
|
||||
});
|
||||
|
||||
var findFontReferences = function(obj) {
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var value = obj[key];
|
||||
if (key == 'text-font') {
|
||||
if (value && value.length > 0) {
|
||||
value.forEach(reportFont);
|
||||
}
|
||||
} else if (value && typeof value == 'object') {
|
||||
findFontReferences(value);
|
||||
}
|
||||
});
|
||||
};
|
||||
styleJSON.layers.forEach(findFontReferences);
|
||||
|
||||
var spritePath = path.join(rootPath, styleJSON.sprite);
|
||||
|
||||
styleJSON.sprite = 'local://styles/' + id + '/sprite';
|
||||
|
||||
Reference in New Issue
Block a user