mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
rename the sourcemappingurl to sourcemapurl, add to bin/lessc and adjust to not normalize
This commit is contained in:
@@ -173,6 +173,11 @@ args = args.filter(function (arg) {
|
||||
case 'source-map-less-inline':
|
||||
options.outputSourceFiles = true;
|
||||
break;
|
||||
case 'source-map-url':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.sourceMapUrl = match[2];
|
||||
}
|
||||
break;
|
||||
case 'rp':
|
||||
case 'rootpath':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
@@ -318,7 +323,7 @@ var parseLessFile = function (e, data) {
|
||||
cleancss: options.cleancss,
|
||||
sourceMap: Boolean(options.sourceMap),
|
||||
sourceMapFilename: options.sourceMap,
|
||||
sourceMappingURL: options.sourceMappingURL,
|
||||
sourceMapURL: options.sourceMapURL,
|
||||
sourceMapOutputFilename: options.sourceMapOutputFilename,
|
||||
sourceMapBasepath: options.sourceMapBasepath,
|
||||
sourceMapRootpath: options.sourceMapRootpath || "",
|
||||
|
||||
@@ -44,6 +44,7 @@ var lessc_helper = {
|
||||
console.log(" --source-map-basepath=X Sets sourcemap base path, defaults to current working directory.");
|
||||
console.log(" --source-map-less-inline puts the less files into the map instead of referencing them");
|
||||
console.log(" --source-map-map-inline puts the map (and any less files) into the output css file");
|
||||
console.log(" --source-map-url=URL the complete url and filename put in the less file");
|
||||
console.log(" -rp, --rootpath=URL Set rootpath for url rewriting in relative imports and urls.");
|
||||
console.log(" Works with or without the relative-urls option.");
|
||||
console.log(" -ru, --relative-urls re-write relative urls to the base less file.");
|
||||
|
||||
@@ -469,7 +469,7 @@ less.Parser = function Parser(env) {
|
||||
rootNode: evaldRoot,
|
||||
contentsMap: parser.imports.contents,
|
||||
sourceMapFilename: options.sourceMapFilename,
|
||||
sourceMappingURL: options.sourceMappingURL,
|
||||
sourceMapURL: options.sourceMapURL,
|
||||
outputFilename: options.sourceMapOutputFilename,
|
||||
sourceMapBasepath: options.sourceMapBasepath,
|
||||
sourceMapRootpath: options.sourceMapRootpath,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
this._contentsMap = options.contentsMap;
|
||||
this._sourceMapFilename = options.sourceMapFilename;
|
||||
this._outputFilename = options.outputFilename;
|
||||
this._sourceMappingURL = options.sourceMappingURL;
|
||||
this._sourceMapURL = options.sourceMapURL;
|
||||
this._sourceMapBasepath = options.sourceMapBasepath;
|
||||
this._sourceMapRootpath = options.sourceMapRootpath;
|
||||
this._outputSourceFiles = options.outputSourceFiles;
|
||||
@@ -93,26 +93,23 @@
|
||||
this._rootNode.genCSS(env, this);
|
||||
|
||||
if (this._css.length > 0) {
|
||||
var sourceMapFilename,
|
||||
sourceMappingURL,
|
||||
var sourceMapURL,
|
||||
sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON());
|
||||
|
||||
if (this._sourceMapFilename) {
|
||||
sourceMapFilename = this.normalizeFilename(this._sourceMapFilename);
|
||||
sourceMapURL = this.normalizeFilename(this._sourceMapFilename);
|
||||
} else if (this._sourceMapURL) {
|
||||
sourceMapURL = this._sourceMapURL;
|
||||
}
|
||||
|
||||
if (this._writeSourceMap) {
|
||||
this._writeSourceMap(sourceMapContent);
|
||||
} else {
|
||||
sourceMapFilename = "data:application/json," + encodeURIComponent(sourceMapContent);
|
||||
sourceMapURL = "data:application/json," + encodeURIComponent(sourceMapContent);
|
||||
}
|
||||
|
||||
if (this._sourceMappingURL) {
|
||||
sourceMappingURL = this.normalizeFilename(this._sourceMappingURL);
|
||||
}
|
||||
|
||||
if (sourceMappingURL || sourceMapFilename) {
|
||||
this._css.push("/*# sourceMappingURL=" + sourceMappingURL || sourceMapFilename + " */");
|
||||
if (sourceMapURL) {
|
||||
this._css.push("/*# sourceMappingURL=" + sourceMapURL + " */");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user