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
78a589b3
Commit
78a589b3
authored
May 15, 2015
by
Michael Mifsud
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #952 from kkopachev/watch-dir
Fix ability to watch whole directory
parents
1a2a9d3d
3daa4e48
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
node-sass
bin/node-sass
+8
-2
cli.js
test/cli.js
+25
-0
index.scss
test/fixtures/watching-dir/index.scss
+1
-0
No files found.
bin/node-sass
View file @
78a589b3
...
...
@@ -199,10 +199,16 @@ function getOptions(args, options) {
*/
function
watch
(
options
,
emitter
)
{
var
src
=
options
.
directory
?
path
.
join
(
options
.
directory
,
globPattern
(
options
))
:
options
.
src
;
var
graph
=
grapher
.
parseDir
(
path
.
resolve
(
path
.
dirname
(
src
)),
{
loadPaths
:
options
.
includePath
});
var
watch
=
[];
var
graphOptions
=
{
loadPaths
:
options
.
includePath
};
var
graph
;
if
(
options
.
directory
)
{
graph
=
grapher
.
parseDir
(
options
.
directory
,
graphOptions
);
}
else
{
graph
=
grapher
.
parseFile
(
options
.
src
,
graphOptions
);
}
// Add all files to watch list
for
(
var
i
in
graph
.
index
)
{
watch
.
push
(
i
);
...
...
test/cli.js
View file @
78a589b3
...
...
@@ -310,6 +310,31 @@ describe('cli', function() {
fs
.
appendFileSync
(
foo
,
'body{background:white}
\
n'
);
},
500
);
});
it
(
'should watch whole directory'
,
function
(
done
)
{
var
destDir
=
fixture
(
'watching-css-out/'
);
var
srcDir
=
fixture
(
'watching-dir/'
);
var
srcFile
=
path
.
join
(
srcDir
,
'index.scss'
);
fs
.
writeFileSync
(
srcFile
,
''
);
var
bin
=
spawn
(
cli
,
[
'--output-style'
,
'compressed'
,
'--output'
,
destDir
,
'--watch'
,
srcDir
]);
setTimeout
(
function
()
{
fs
.
appendFileSync
(
srcFile
,
'a {color:green;}
\
n'
);
setTimeout
(
function
()
{
bin
.
kill
();
var
files
=
fs
.
readdirSync
(
destDir
);
assert
.
deepEqual
(
files
,
[
'index.css'
]);
rimraf
.
sync
(
destDir
);
done
();
},
200
);
},
500
);
});
});
describe
(
'node-sass in.scss --output out.css'
,
function
()
{
...
...
test/fixtures/watching-dir/index.scss
0 → 100644
View file @
78a589b3
a
{
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