Fixes #550 - proper `contentSources` tracking.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 28 Apr 2015 08:47:47 +0000 (09:47 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 28 Apr 2015 08:52:38 +0000 (09:52 +0100)
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
lib/utils/input-source-map-tracker.js

index e18f1ad..7f4aad2 100644 (file)
@@ -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)
index 1ffc70b..fbf5ebd 100644 (file)
@@ -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);