Major cleaning of paths and urls

This commit is contained in:
Petr Sloup
2016-03-11 10:50:33 +01:00
parent d1e33d04cb
commit 8a46bd8b88
5 changed files with 43 additions and 31 deletions
+5 -6
View File
@@ -7,14 +7,12 @@ var clone = require('clone'),
express = require('express');
module.exports = function(repo, options, id, reportVector, reportFont) {
module.exports = function(options, repo, params, id, reportVector, reportFont) {
var app = express().disable('x-powered-by');
var rootPath = path.join(process.cwd(), options.root || '');
var styleFile = path.join(options.paths.styles, params.style);
var styleUrl = path.join(rootPath, options.style);
var styleJSON = clone(require(styleUrl));
var styleJSON = clone(require(styleFile));
Object.keys(styleJSON.sources).forEach(function(name) {
var source = styleJSON.sources[name];
var url = source.url;
@@ -39,7 +37,8 @@ module.exports = function(repo, options, id, reportVector, reportFont) {
};
styleJSON.layers.forEach(findFontReferences);
var spritePath = path.join(rootPath, styleJSON.sprite);
var spritePath = path.join(options.paths.sprites,
path.basename(styleFile, '.json'));
styleJSON.sprite = 'local://styles/' + id + '/sprite';
styleJSON.glyphs = 'local://fonts/{fontstack}/{range}.pbf';