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
c2471a63
Commit
c2471a63
authored
Sep 30, 2014
by
Kevin Martensson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't write to stdout if `--output` is specified
Fixes #436.
parent
fdd9868e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
cli.js
lib/cli.js
+1
-1
render.js
lib/render.js
+1
-1
cli.js
test/cli.js
+17
-0
No files found.
lib/cli.js
View file @
c2471a63
...
@@ -162,7 +162,7 @@ module.exports = function(args) {
...
@@ -162,7 +162,7 @@ module.exports = function(args) {
options
.
src
=
argv
.
_
[
0
];
options
.
src
=
argv
.
_
[
0
];
options
.
dest
=
argv
.
o
||
argv
.
_
[
1
];
options
.
dest
=
argv
.
o
||
argv
.
_
[
1
];
if
(
!
options
.
dest
)
{
if
(
!
options
.
dest
&&
(
process
.
stdout
.
isTTY
||
process
.
env
.
isTTY
)
)
{
var
suffix
=
'.css'
;
var
suffix
=
'.css'
;
if
(
/
\.
css$/
.
test
(
options
.
src
))
{
if
(
/
\.
css$/
.
test
(
options
.
src
))
{
suffix
=
''
;
suffix
=
''
;
...
...
lib/render.js
View file @
c2471a63
...
@@ -28,7 +28,7 @@ function render(options, emitter) {
...
@@ -28,7 +28,7 @@ function render(options, emitter) {
}
}
};
};
if
(
options
.
stdout
||
(
!
process
.
stdout
.
isTTY
&&
!
process
.
env
.
isTTY
))
{
if
(
options
.
stdout
||
(
!
options
.
dest
&&
(
!
process
.
stdout
.
isTTY
||
!
process
.
env
.
isTTY
)
))
{
emitter
.
emit
(
'log'
,
css
);
emitter
.
emit
(
'log'
,
css
);
return
done
();
return
done
();
}
}
...
...
test/cli.js
View file @
c2471a63
...
@@ -47,6 +47,23 @@ describe('cli', function() {
...
@@ -47,6 +47,23 @@ describe('cli', function() {
src
.
pipe
(
emitter
.
stdin
);
src
.
pipe
(
emitter
.
stdin
);
});
});
it
(
'should write to disk when using --output'
,
function
(
done
)
{
this
.
timeout
(
6000
);
var
src
=
fs
.
createReadStream
(
sampleScssPath
);
var
emitter
=
spawn
(
cliPath
,
[
'--output'
,
sampleCssOutputPath
],
{
stdio
:
[
null
,
'ignore'
,
null
]
});
emitter
.
on
(
'close'
,
function
()
{
fs
.
exists
(
sampleCssOutputPath
,
function
(
exists
)
{
assert
(
exists
);
fs
.
unlink
(
sampleCssOutputPath
,
done
);
});
});
src
.
pipe
(
emitter
.
stdin
);
});
it
(
'should print help when run with no arguments'
,
function
(
done
)
{
it
(
'should print help when run with no arguments'
,
function
(
done
)
{
var
env
=
assign
(
process
.
env
,
{
isTTY
:
true
});
var
env
=
assign
(
process
.
env
,
{
isTTY
:
true
});
exec
(
'node '
+
cliPath
,
{
exec
(
'node '
+
cliPath
,
{
...
...
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