};
Rebuilder.prototype.trackMetadata = function (metadata) {
- var original = this.inputMapTracker.isTracking() ?
+ var original = this.inputMapTracker.isTracking(metadata) ?
this.inputMapTracker.originalPositionFor(metadata) :
{};
fromSource(this, data, whenDone, { files: [], cursor: 0, errors: this.errors });
};
-InputSourceMapStore.prototype.isTracking = function () {
- return Object.keys(this.maps).length > 0;
+InputSourceMapStore.prototype.isTracking = function (sourceInfo) {
+ return !!this.maps[sourceInfo.source];
};
InputSourceMapStore.prototype.originalPositionFor = function (sourceInfo) {
'should have 4 mappings': function (minified) {
assert.equal(4, minified.sourceMap._mappings.length);
}
+ },
+ 'complex but partial input map referenced by path': {
+ 'topic': new CleanCSS({ sourceMap: true }).minify('@import url(test/data/source-maps/no-map-import.css);'),
+ 'should have 4 mappings': function (minified) {
+ assert.equal(4, minified.sourceMap._mappings.length);
+ },
+ 'should have 2 mappings to .less file': function (minified) {
+ var fromLess = minified.sourceMap._mappings.filter(function (mapping) {
+ return mapping.source == 'styles.less';
+ });
+ assert.equal(2, fromLess.length);
+ },
+ 'should have 2 mappings to .css file': function (minified) {
+ var fromCSS = minified.sourceMap._mappings.filter(function (mapping) {
+ return mapping.source.indexOf('no-map.css') > 0;
+ });
+ assert.equal(2, fromCSS.length);
+ }
}
})
.addBatch({