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
b77299c3
Commit
b77299c3
authored
Oct 03, 2013
by
Laurent Goderre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverted the render events to their original and adapted the test to avoid async race
parent
805ef4ff
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
render.js
lib/render.js
+3
-1
cli.js
test/cli.js
+7
-7
No files found.
lib/render.js
View file @
b77299c3
...
@@ -20,11 +20,13 @@ function render(options, emitter) {
...
@@ -20,11 +20,13 @@ function render(options, emitter) {
if
(
err
)
return
emitter
.
emit
(
'error'
,
(
'Error: '
+
err
).
red
);
if
(
err
)
return
emitter
.
emit
(
'error'
,
(
'Error: '
+
err
).
red
);
emitter
.
emit
(
'warn'
,
(
'Wrote CSS to '
+
options
.
outFile
).
green
);
emitter
.
emit
(
'warn'
,
(
'Wrote CSS to '
+
options
.
outFile
).
green
);
emitter
.
emit
(
'write'
,
err
,
options
.
outFile
,
css
);
emitter
.
emit
(
'write'
,
err
,
options
.
outFile
,
css
);
});
if
(
options
.
stdout
)
{
if
(
options
.
stdout
)
{
emitter
.
emit
(
'log'
,
css
);
emitter
.
emit
(
'log'
,
css
);
}
}
emitter
.
emit
(
'render'
,
css
);
emitter
.
emit
(
'render'
,
css
);
});
},
},
error
:
function
(
error
)
{
error
:
function
(
error
)
{
emitter
.
emit
(
'error'
,
error
);
emitter
.
emit
(
'error'
,
error
);
...
...
test/cli.js
View file @
b77299c3
...
@@ -67,27 +67,27 @@ describe('cli', function() {
...
@@ -67,27 +67,27 @@ describe('cli', function() {
path
.
join
(
__dirname
,
'include_path.scss'
)
path
.
join
(
__dirname
,
'include_path.scss'
)
]);
]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'
render'
,
function
(
css
){
emitter
.
on
(
'
write'
,
function
(
err
,
file
,
css
){
assert
.
equal
(
css
.
trim
(),
'body {
\
n background: red;
\
n color: blue; }'
);
assert
.
equal
(
css
.
trim
(),
'body {
\
n background: red;
\
n color: blue; }'
);
fs
.
unlink
(
path
.
resolve
(
process
.
cwd
(),
'include_path.css'
)
,
done
);
fs
.
unlink
(
file
,
done
);
});
});
});
});
it
(
'should compile with the --output-style'
,
function
(
done
){
it
(
'should compile with the --output-style'
,
function
(
done
){
var
emitter
=
cli
([
'--output-style'
,
'compressed'
,
path
.
join
(
__dirname
,
'sample.scss'
)]);
var
emitter
=
cli
([
'--output-style'
,
'compressed'
,
path
.
join
(
__dirname
,
'sample.scss'
)]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'
render'
,
function
(
css
){
emitter
.
on
(
'
write'
,
function
(
err
,
file
,
css
){
assert
.
equal
(
css
,
expectedSampleCompressed
);
assert
.
equal
(
css
,
expectedSampleCompressed
);
fs
.
unlink
(
path
.
resolve
(
process
.
cwd
(),
'sample.css'
)
,
done
);
fs
.
unlink
(
file
,
done
);
});
});
});
});
it
(
'should compile with the --source-comments option'
,
function
(
done
){
it
(
'should compile with the --source-comments option'
,
function
(
done
){
var
emitter
=
cli
([
'--source-comments'
,
'none'
,
path
.
join
(
__dirname
,
'sample.scss'
)]);
var
emitter
=
cli
([
'--source-comments'
,
'none'
,
path
.
join
(
__dirname
,
'sample.scss'
)]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'
render'
,
function
(
css
){
emitter
.
on
(
'
write'
,
function
(
err
,
file
,
css
){
assert
.
equal
(
css
,
expectedSampleNoComments
);
assert
.
equal
(
css
,
expectedSampleNoComments
);
fs
.
unlink
(
path
.
resolve
(
process
.
cwd
(),
'sample.css'
)
,
done
);
fs
.
unlink
(
file
,
done
);
});
});
});
});
...
@@ -95,7 +95,7 @@ describe('cli', function() {
...
@@ -95,7 +95,7 @@ describe('cli', function() {
var
resultPath
=
path
.
join
(
__dirname
,
'../output.css'
);
var
resultPath
=
path
.
join
(
__dirname
,
'../output.css'
);
var
emitter
=
cli
([
'--output'
,
resultPath
,
path
.
join
(
__dirname
,
'sample.scss'
)]);
var
emitter
=
cli
([
'--output'
,
resultPath
,
path
.
join
(
__dirname
,
'sample.scss'
)]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'write'
,
function
(
css
){
emitter
.
on
(
'write'
,
function
(
err
,
file
,
css
){
fs
.
exists
(
resultPath
,
function
(
exists
)
{
fs
.
exists
(
resultPath
,
function
(
exists
)
{
assert
(
exists
);
assert
(
exists
);
fs
.
unlink
(
resultPath
,
done
);
fs
.
unlink
(
resultPath
,
done
);
...
...
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