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
6a818b5d
Commit
6a818b5d
authored
Apr 12, 2015
by
Paul C Pederson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CLI: Adds --quiet flag
parent
fce09934
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
1 deletions
+86
-1
README.md
README.md
+1
-0
node-sass
bin/node-sass
+7
-1
cli.js
test/cli.js
+75
-0
index.scss
test/fixtures/invalid/index.scss
+3
-0
No files found.
README.md
View file @
6a818b5d
...
...
@@ -452,6 +452,7 @@ Output will be saved with the same name as input SASS file into the current work
-o, --output Output directory
-x, --omit-source-map-url Omit source map URL comment from output
-i, --indented-syntax Treat data from stdin as sass code (versus scss)
-q, --quiet Suppress log output except on error
-v, --version Prints version info
--output-style CSS output style (nested | expanded | compact | compressed)
--indent-type Indent type for output CSS (space | tab)
...
...
bin/node-sass
View file @
6a818b5d
...
...
@@ -34,6 +34,7 @@ var cli = meow({
' -o, --output Output directory'
,
' -x, --omit-source-map-url Omit source map URL comment from output'
,
' -i, --indented-syntax Treat data from stdin as sass code (versus scss)'
,
' -q, --quiet Suppress log output except on error'
,
' -v, --version Prints version info'
,
' --output-style CSS output style (nested | expanded | compact | compressed)'
,
' --indent-type Indent type for output CSS (space | tab)'
,
...
...
@@ -54,6 +55,7 @@ var cli = meow({
boolean
:
[
'indented-syntax'
,
'omit-source-map-url'
,
'quiet'
,
'recursive'
,
'source-map-embed'
,
'source-map-contents'
,
...
...
@@ -74,6 +76,7 @@ var cli = meow({
alias
:
{
c
:
'source-comments'
,
i
:
'indented-syntax'
,
q
:
'quiet'
,
o
:
'output'
,
r
:
'recursive'
,
x
:
'omit-source-map-url'
,
...
...
@@ -87,6 +90,7 @@ var cli = meow({
linefeed
:
'lf'
,
'output-style'
:
'nested'
,
precision
:
5
,
quiet
:
false
,
recursive
:
true
}
});
...
...
@@ -139,7 +143,9 @@ function getEmitter() {
});
emitter
.
on
(
'warn'
,
function
(
data
)
{
console
.
warn
(
data
);
if
(
!
options
.
quiet
)
{
console
.
warn
(
data
);
}
});
emitter
.
on
(
'log'
,
function
(
data
)
{
...
...
test/cli.js
View file @
6a818b5d
...
...
@@ -39,6 +39,20 @@ describe('cli', function() {
src
.
pipe
(
bin
.
stdin
);
});
it
(
'should compile with the --quiet option'
,
function
(
done
)
{
var
src
=
fs
.
createReadStream
(
fixture
(
'simple/index.scss'
));
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
var
bin
=
spawn
(
cli
,
[
'--quiet'
]);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
.
equal
(
data
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
});
src
.
pipe
(
bin
.
stdin
);
});
it
(
'should compile with the --output-style option'
,
function
(
done
)
{
var
src
=
fs
.
createReadStream
(
fixture
(
'compressed/index.scss'
));
var
expected
=
read
(
fixture
(
'compressed/expected.css'
),
'utf8'
).
trim
();
...
...
@@ -150,6 +164,45 @@ describe('cli', function() {
});
});
it
(
'should compile silently using the --quiet option'
,
function
(
done
)
{
process
.
chdir
(
fixture
(
'simple'
));
var
src
=
fixture
(
'simple/index.scss'
);
var
dest
=
fixture
(
'simple/index.css'
);
var
bin
=
spawn
(
cli
,
[
src
,
dest
,
'--quiet'
]);
var
didEmit
=
false
;
bin
.
stderr
.
once
(
'data'
,
function
()
{
didEmit
=
true
;
});
bin
.
once
(
'close'
,
function
()
{
assert
.
equal
(
didEmit
,
false
);
fs
.
unlinkSync
(
dest
);
process
.
chdir
(
__dirname
);
done
();
});
});
it
(
'should still report errors with the --quiet option'
,
function
(
done
)
{
process
.
chdir
(
fixture
(
'invalid'
));
var
src
=
fixture
(
'invalid/index.scss'
);
var
dest
=
fixture
(
'invalid/index.css'
);
var
bin
=
spawn
(
cli
,
[
src
,
dest
,
'--quiet'
]);
var
didEmit
=
false
;
bin
.
stderr
.
once
(
'data'
,
function
()
{
didEmit
=
true
;
});
bin
.
once
(
'close'
,
function
()
{
assert
.
equal
(
didEmit
,
true
);
process
.
chdir
(
__dirname
);
done
();
});
});
it
(
'should not exit with the --watch option'
,
function
(
done
)
{
var
src
=
fixture
(
'simple/index.scss'
);
var
bin
=
spawn
(
cli
,
[
src
,
'--watch'
]);
...
...
@@ -188,6 +241,28 @@ describe('cli', function() {
},
500
);
});
it
(
'should emit nothing on file change when using --watch and --quiet options'
,
function
(
done
)
{
var
src
=
fixture
(
'simple/tmp.scss'
);
var
didEmit
=
false
;
fs
.
writeFileSync
(
src
,
''
);
var
bin
=
spawn
(
cli
,
[
'--watch'
,
'--quiet'
,
src
]);
bin
.
stderr
.
setEncoding
(
'utf8'
);
bin
.
stderr
.
once
(
'data'
,
function
()
{
didEmit
=
true
;
});
setTimeout
(
function
()
{
fs
.
appendFileSync
(
src
,
'body {}'
);
setTimeout
(
function
()
{
assert
.
equal
(
didEmit
,
false
);
done
();
fs
.
unlinkSync
(
src
);
},
200
);
},
500
);
});
it
(
'should render all watched files'
,
function
(
done
)
{
var
src
=
fixture
(
'simple/bar.scss'
);
...
...
test/fixtures/invalid/index.scss
0 → 100644
View file @
6a818b5d
body
{
background-color
:
$green
;
}
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