Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Merge 334d188 into 845326c
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Jan 14, 2015
2 parents 845326c + 334d188 commit 1f2ad5d
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions bin/node-sass
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,10 @@ function getEmitter() {
*/

function getOptions(args, options) {
var dir = options.output || process.cwd();
var dir = options.output ? path.resolve(process.cwd(), options.output) : process.cwd();

options.src = args[0];
options.dest = null;

if (args[1]) { // destination is available
// now first check if the destination is absolute path
// see http://stackoverflow.com/a/24225816/863980 for Marc Diethelm's comment
if (path.resolve(args[1]) === path.normalize(args[1]).replace(/(.+)([\/|\\])$/, '$1')) {
options.dest = args[1];
} else { // since dest path is relative, resolve it w.r.t input
options.dest = path.join(dir, args[1]);
}
}
options.dest = args[1] ? path.resolve(dir, args[1]) : undefined;

if (!options.dest && !options.stdout) {
var ext = path.extname(options.src);
Expand Down Expand Up @@ -200,7 +190,7 @@ function run(options, emitter) {
}

if (options.sourceMap) {
if (options.sourceMap === true) {
if (options.sourceMap === 'true') {
options.sourceMap = options.dest + '.map';
} else {
options.sourceMap = path.resolve(process.cwd(), options.sourceMap);
Expand Down

0 comments on commit 1f2ad5d

Please sign in to comment.