mirror of
https://github.com/less/less.js.git
synced 2026-01-22 21:58:14 -05:00
normalize the base path as well as the filename for sourcemaps. Fixes #1736
This commit is contained in:
@@ -8,7 +8,9 @@
|
||||
this._sourceMapFilename = options.sourceMapFilename;
|
||||
this._outputFilename = options.outputFilename;
|
||||
this._sourceMapURL = options.sourceMapURL;
|
||||
this._sourceMapBasepath = options.sourceMapBasepath;
|
||||
if (this._sourceMapBasepath) {
|
||||
this._sourceMapBasepath = options.sourceMapBasepath.replace(/\\/g, '/');
|
||||
}
|
||||
this._sourceMapRootpath = options.sourceMapRootpath;
|
||||
this._outputSourceFiles = options.outputSourceFiles;
|
||||
this._sourceMapGeneratorConstructor = options.sourceMapGenerator || require("source-map").SourceMapGenerator;
|
||||
@@ -22,13 +24,14 @@
|
||||
};
|
||||
|
||||
tree.sourceMapOutput.prototype.normalizeFilename = function(filename) {
|
||||
filename = filename.replace(/\\/g, '/');
|
||||
if (this._sourceMapBasepath && filename.indexOf(this._sourceMapBasepath) === 0) {
|
||||
filename = filename.substring(this._sourceMapBasepath.length);
|
||||
if (filename.charAt(0) === '\\' || filename.charAt(0) === '/') {
|
||||
filename = filename.substring(1);
|
||||
}
|
||||
filename = filename.substring(this._sourceMapBasepath.length);
|
||||
if (filename.charAt(0) === '\\' || filename.charAt(0) === '/') {
|
||||
filename = filename.substring(1);
|
||||
}
|
||||
}
|
||||
return (this._sourceMapRootpath || "") + filename.replace(/\\/g, '/');
|
||||
return (this._sourceMapRootpath || "") + filename;
|
||||
};
|
||||
|
||||
tree.sourceMapOutput.prototype.add = function(chunk, fileInfo, index, mapLines) {
|
||||
|
||||
Reference in New Issue
Block a user