added sourceMappingURL option

This commit is contained in:
Kevin Attfield
2013-10-29 11:12:50 -07:00
committed by Luke Page
parent 5b3b04869b
commit 855eca1d93
3 changed files with 10 additions and 2 deletions

View File

@@ -318,6 +318,7 @@ var parseLessFile = function (e, data) {
cleancss: options.cleancss,
sourceMap: Boolean(options.sourceMap),
sourceMapFilename: options.sourceMap,
sourceMappingURL: options.sourceMappingURL,
sourceMapOutputFilename: options.sourceMapOutputFilename,
sourceMapBasepath: options.sourceMapBasepath,
sourceMapRootpath: options.sourceMapRootpath || "",

View File

@@ -469,6 +469,7 @@ less.Parser = function Parser(env) {
rootNode: evaldRoot,
contentsMap: parser.imports.contents,
sourceMapFilename: options.sourceMapFilename,
sourceMappingURL: options.sourceMappingURL,
outputFilename: options.sourceMapOutputFilename,
sourceMapBasepath: options.sourceMapBasepath,
sourceMapRootpath: options.sourceMapRootpath,

View File

@@ -7,6 +7,7 @@
this._contentsMap = options.contentsMap;
this._sourceMapFilename = options.sourceMapFilename;
this._outputFilename = options.outputFilename;
this._sourceMappingURL = options.sourceMappingURL;
this._sourceMapBasepath = options.sourceMapBasepath;
this._sourceMapRootpath = options.sourceMapRootpath;
this._outputSourceFiles = options.outputSourceFiles;
@@ -93,6 +94,7 @@
if (this._css.length > 0) {
var sourceMapFilename,
sourceMappingURL,
sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON());
if (this._sourceMapFilename) {
@@ -105,8 +107,12 @@
sourceMapFilename = "data:application/json," + encodeURIComponent(sourceMapContent);
}
if (sourceMapFilename) {
this._css.push("/*# sourceMappingURL=" + sourceMapFilename + " */");
if (this._sourceMappingURL) {
sourceMappingURL = this.normalizeFilename(this._sourceMappingURL);
}
if (sourceMappingURL || sourceMapFilename) {
this._css.push("/*# sourceMappingURL=" + sourceMappingURL || sourceMapFilename + " */");
}
}