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
4ed6de22
Commit
4ed6de22
authored
Mar 28, 2015
by
Wes Todd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted watch to a boolean and got it actually working correctly
parent
dc237d98
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
21 deletions
+41
-21
node-sass
bin/node-sass
+16
-21
cli.js
test/cli.js
+22
-0
foo.scss
test/fixtures/watching/foo.scss
+2
-0
index.scss
test/fixtures/watching/index.scss
+1
-0
No files found.
bin/node-sass
View file @
4ed6de22
...
...
@@ -53,7 +53,8 @@ var cli = meow({
'recursive'
,
'source-map-embed'
,
'source-map-contents'
,
'source-comments'
'source-comments'
,
'watch'
],
string
:
[
'functions'
,
...
...
@@ -64,8 +65,7 @@ var cli = meow({
'output'
,
'output-style'
,
'precision'
,
'source-map-root'
,
'watch'
'source-map-root'
],
alias
:
{
c
:
'source-comments'
,
...
...
@@ -82,7 +82,8 @@ var cli = meow({
'indent-width'
:
2
,
linefeed
:
'lf'
,
'output-style'
:
'nested'
,
precision
:
5
precision
:
5
,
recursive
:
true
}
});
...
...
@@ -139,7 +140,7 @@ function getEmitter() {
*/
function
getOptions
(
args
,
options
)
{
options
.
src
=
options
.
watch
?
options
.
watch
:
args
[
0
];
options
.
src
=
args
[
0
];
if
(
args
[
1
])
{
options
.
dest
=
path
.
resolve
(
process
.
cwd
(),
args
[
1
]);
...
...
@@ -161,26 +162,20 @@ function getOptions(args, options) {
*/
function
watch
(
options
,
emitter
)
{
var
dir
=
options
.
watch
;
var
gaze
=
new
Gaze
();
if
(
dir
===
true
)
{
dir
=
[];
}
else
if
(
!
Array
.
isArray
(
dir
))
{
dir
=
[
dir
];
var
glob
=
options
.
recursive
?
'**/*.{sass,scss}'
:
'*.{sass,scss}'
;
var
src
=
isSassFile
(
options
.
src
)
?
options
.
src
:
path
.
join
(
options
.
src
,
glob
);
var
graph
=
grapher
.
parseDir
(
path
.
resolve
(
path
.
dirname
(
src
)),
{
loadPaths
:
options
.
includePath
});
var
watch
=
[];
// Add all files to watch list
for
(
var
i
in
graph
.
index
)
{
watch
.
push
(
i
);
}
dir
.
push
(
options
.
src
);
dir
=
dir
.
map
(
function
(
d
)
{
var
glob
=
options
.
recursive
?
'**/*.{sass,scss}'
:
'*.{sass,scss}'
;
return
isSassFile
(
d
)
?
d
:
path
.
join
(
d
,
glob
);
});
gaze
.
add
(
dir
);
var
gaze
=
new
Gaze
();
gaze
.
add
(
watch
);
gaze
.
on
(
'error'
,
emitter
.
emit
.
bind
(
emitter
,
'error'
));
var
graph
=
grapher
.
parseDir
(
options
.
src
,
{
loadPaths
:
options
.
includePath
});
gaze
.
on
(
'changed'
,
function
(
file
)
{
var
files
=
[
file
];
graph
.
visitAncestors
(
file
,
function
(
parent
)
{
...
...
test/cli.js
View file @
4ed6de22
...
...
@@ -207,6 +207,28 @@ describe('cli', function() {
fs
.
appendFileSync
(
src
,
'body{background:white}'
);
},
500
);
});
it
(
'should watch the full sass dep tree for a single file'
,
function
(
done
)
{
var
src
=
fixture
(
'watching/index.scss'
);
var
foo
=
fixture
(
'watching/foo.scss'
);
fs
.
writeFileSync
(
foo
,
''
);
var
bin
=
spawn
(
cli
,
[
'--output-style'
,
'compressed'
,
'--watch'
,
src
]);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
(
data
.
trim
()
===
'body{background:white}'
);
done
();
});
setTimeout
(
function
()
{
fs
.
appendFileSync
(
foo
,
'body{background:white}'
);
},
500
);
});
});
describe
(
'node-sass in.scss --output out.css'
,
function
()
{
...
...
test/fixtures/watching/foo.scss
0 → 100644
View file @
4ed6de22
body
{
background
:white
}
\ No newline at end of file
test/fixtures/watching/index.scss
0 → 100644
View file @
4ed6de22
@import
'./foo'
;
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