From 10d5a3b9f9e9910deea323ec4d1be1abc9e46b09 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Tue, 28 Apr 2015 09:47:47 +0100 Subject: [PATCH] Fixes #550 - proper `contentSources` tracking. This is a quick fix so an exception is not thrown, but the real question will be how to preserve bootstrap maps as they are not tracked correctly due to `sourcesContent` having wrong (?) source data. See #557. --- History.md | 1 + lib/utils/input-source-map-tracker.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/History.md b/History.md index e18f1adb..7f4aad26 100644 --- a/History.md +++ b/History.md @@ -12,6 +12,7 @@ [3.2.6 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.5...3.2) ================== +* Fixed issue [#550](https://github.com/jakubpawlowicz/clean-css/issues/550) - proper `contentSources` tracking. * Fixed issue [#556](https://github.com/jakubpawlowicz/clean-css/issues/556) - regression in IE backslash hacks. [3.2.5 / 2015-04-25](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.4...v3.2.5) diff --git a/lib/utils/input-source-map-tracker.js b/lib/utils/input-source-map-tracker.js index 1ffc70bb..fbf5ebd2 100644 --- a/lib/utils/input-source-map-tracker.js +++ b/lib/utils/input-source-map-tracker.js @@ -146,7 +146,7 @@ function originalPositionIn(trackedSource, line, column, token, allowNFallbacks) if (originalPosition.line === null && line > 1 && allowNFallbacks > 0) return originalPositionIn(trackedSource, line - 1, column, token, allowNFallbacks - 1); - if (trackedSource.path) { + if (trackedSource.path && originalPosition.source) { originalPosition.source = REMOTE_RESOURCE.test(trackedSource.path) ? url.resolve(trackedSource.path, originalPosition.source) : path.join(trackedSource.path, originalPosition.source); -- 2.34.1