[Pkg-javascript-commits] [less.js] 131/285: simplify sourcemapfilename in lessc and expose the output filename
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v2.0.0
in repository less.js.
commit 40e0b212a6e7161973d558ecb9bdf214a11f1a06
Author: Luke Page <luke.a.page at gmail.com>
Date: Sat Sep 20 03:26:06 2014 +0100
simplify sourcemapfilename in lessc and expose the output filename
---
bin/lessc | 9 ++++-----
lib/less/source-map-builder.js | 3 +++
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/bin/lessc b/bin/lessc
index 8c485b9..4032a4d 100755
--- a/bin/lessc
+++ b/bin/lessc
@@ -153,7 +153,7 @@ args = args.filter(function (arg) {
case 'source-map':
options.sourceMap = true;
if (match[2]) {
- sourceMapOptions.sourceMapFilename = match[2];
+ sourceMapOptions.sourceMapFullFilename = match[2];
}
break;
case 'source-map-rootpath':
@@ -258,7 +258,7 @@ if (output) {
sourceMapOptions.sourceMapBasepath = options.sourceMapBasepath || (input ? path.dirname(input) : process.cwd());
if (options.sourceMap) {
- if (!sourceMapOptions.sourceMapFilename) {
+ if (!sourceMapOptions.sourceMapFullFilename) {
if (!output && !sourceMapFileInline) {
console.log("the sourcemap option only has an optional filename if the css filename is given");
console.log("consider adding --source-map-map-inline which embeds the sourcemap into the css");
@@ -270,7 +270,7 @@ if (options.sourceMap) {
// its in the same directory, so always just the basename
sourceMapOptions.sourceMapFilename = path.basename(sourceMapOptions.sourceMapFullFilename);
} else if (options.sourceMap && !sourceMapFileInline) {
- var mapFilename = path.resolve(process.cwd(), sourceMapOptions.sourceMapFilename),
+ var mapFilename = path.resolve(process.cwd(), sourceMapOptions.sourceMapFullFilename),
mapDir = path.dirname(mapFilename),
outputDir = path.dirname(output);
// find the path from the map to the output file
@@ -278,7 +278,6 @@ if (options.sourceMap) {
path.relative(mapDir, outputDir), path.basename(output));
// make the sourcemap filename point to the sourcemap relative to the css file output directory
- sourceMapOptions.sourceMapFullFilename = sourceMapOptions.sourceMapFilename;
sourceMapOptions.sourceMapFilename = path.join(
path.relative(outputDir, mapDir), path.basename(sourceMapOptions.sourceMapFullFilename));
console.log(sourceMapOptions.sourceMapFile);
@@ -317,7 +316,7 @@ if (options.depends) {
if (!sourceMapFileInline) {
var writeSourceMap = function(output) {
- var filename = sourceMapOptions.sourceMapFullFilename || sourceMapOptions.sourceMapFilename;
+ var filename = sourceMapOptions.sourceMapFullFilename;
ensureDirectory(filename);
fs.writeFileSync(filename, output, 'utf8');
};
diff --git a/lib/less/source-map-builder.js b/lib/less/source-map-builder.js
index 68df618..826533e 100644
--- a/lib/less/source-map-builder.js
+++ b/lib/less/source-map-builder.js
@@ -39,6 +39,9 @@ module.exports = function (SourceMapOutput) {
SourceMapBuilder.prototype.getSourceMapURL = function() {
return this.sourceMapURL;
};
+ SourceMapBuilder.prototype.getOutputFilename = function() {
+ return this.options.sourceMapOutputFilename;
+ };
return SourceMapBuilder;
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git
More information about the Pkg-javascript-commits
mailing list