Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
c9e3eaad
Commit
c9e3eaad
authored
Jan 15, 2015
by
Adeel Mujahid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #625 from am11/master
CLI: Simplifies path resolution for dest
parents
fda34bad
6ef18f81
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
node-sass
bin/node-sass
+3
-13
cli.js
test/cli.js
+15
-0
No files found.
bin/node-sass
View file @
c9e3eaad
...
@@ -126,20 +126,10 @@ function getEmitter() {
...
@@ -126,20 +126,10 @@ function getEmitter() {
*/
*/
function
getOptions
(
args
,
options
)
{
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
.
src
=
args
[
0
];
options
.
dest
=
null
;
options
.
dest
=
args
[
1
]
?
path
.
resolve
(
dir
,
args
[
1
])
:
undefined
;
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
]);
}
}
if
(
!
options
.
dest
&&
!
options
.
stdout
)
{
if
(
!
options
.
dest
&&
!
options
.
stdout
)
{
var
ext
=
path
.
extname
(
options
.
src
);
var
ext
=
path
.
extname
(
options
.
src
);
...
@@ -204,7 +194,7 @@ function run(options, emitter) {
...
@@ -204,7 +194,7 @@ function run(options, emitter) {
}
}
if
(
options
.
sourceMap
)
{
if
(
options
.
sourceMap
)
{
if
(
options
.
sourceMap
===
true
)
{
if
(
options
.
sourceMap
===
'true'
)
{
options
.
sourceMap
=
options
.
dest
+
'.map'
;
options
.
sourceMap
=
options
.
dest
+
'.map'
;
}
else
{
}
else
{
options
.
sourceMap
=
path
.
resolve
(
process
.
cwd
(),
options
.
sourceMap
);
options
.
sourceMap
=
path
.
resolve
(
process
.
cwd
(),
options
.
sourceMap
);
...
...
test/cli.js
View file @
c9e3eaad
...
@@ -95,6 +95,21 @@ describe('cli', function() {
...
@@ -95,6 +95,21 @@ describe('cli', function() {
});
});
});
});
it
(
'should compile a scss file to custom destination'
,
function
(
done
)
{
process
.
chdir
(
fixture
(
'simple'
));
var
src
=
fixture
(
'simple/index.scss'
);
var
dest
=
fixture
(
'simple/index-custom.css'
);
var
bin
=
spawn
(
cli
,
[
src
,
dest
]);
bin
.
on
(
'close'
,
function
()
{
assert
(
fs
.
existsSync
(
dest
));
fs
.
unlinkSync
(
dest
);
process
.
chdir
(
__dirname
);
done
();
});
});
it
(
'should compile with the --include-path option'
,
function
(
done
)
{
it
(
'should compile with the --include-path option'
,
function
(
done
)
{
var
includePaths
=
[
var
includePaths
=
[
'--include-path'
,
fixture
(
'include-path/functions'
),
'--include-path'
,
fixture
(
'include-path/functions'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment