From f25378d3f6f00a06307de1322418034733afa780 Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Wed, 26 Oct 2016 17:45:48 +0200 Subject: [PATCH] Fix URL rebase (fixes #39) --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 651f207..5610323 100644 --- a/index.js +++ b/index.js @@ -38,8 +38,10 @@ module.exports = function(destFile, options) { return url; } - var resourceAbsUrl = path.relative(commonBase, path.resolve(path.dirname(file), url)); - resourceAbsUrl = path.relative(destDir, resourceAbsUrl); + var resourceAbsUrl = path.relative( + path.resolve(commonBase, destDir), + path.resolve(path.dirname(file), url) + ); //not all systems use forward slash as path separator //this is required by urls. if(path.sep === '\\'){