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
02a3712d
Commit
02a3712d
authored
May 11, 2015
by
Konstantin Kopachev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix multi-file compile only writes to the last path when multiple changed
parent
23e62828
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
11 deletions
+40
-11
render.js
lib/render.js
+15
-11
cli.js
test/cli.js
+25
-0
No files found.
lib/render.js
View file @
02a3712d
...
@@ -42,6 +42,10 @@ module.exports = function(options, emitter) {
...
@@ -42,6 +42,10 @@ module.exports = function(options, emitter) {
renderOptions
.
file
=
options
.
src
;
renderOptions
.
file
=
options
.
src
;
}
}
var
sourceMap
=
options
.
sourceMap
;
var
destination
=
options
.
dest
;
var
stdin
=
options
.
stdin
;
var
success
=
function
(
result
)
{
var
success
=
function
(
result
)
{
var
todo
=
1
;
var
todo
=
1
;
var
done
=
function
()
{
var
done
=
function
()
{
...
@@ -50,10 +54,10 @@ module.exports = function(options, emitter) {
...
@@ -50,10 +54,10 @@ module.exports = function(options, emitter) {
}
}
};
};
if
(
!
options
.
dest
||
options
.
stdin
)
{
if
(
!
destination
||
stdin
)
{
emitter
.
emit
(
'log'
,
result
.
css
.
toString
());
emitter
.
emit
(
'log'
,
result
.
css
.
toString
());
if
(
options
.
sourceMap
)
{
if
(
sourceMap
)
{
emitter
.
emit
(
'log'
,
result
.
map
.
toString
());
emitter
.
emit
(
'log'
,
result
.
map
.
toString
());
}
}
...
@@ -62,36 +66,36 @@ module.exports = function(options, emitter) {
...
@@ -62,36 +66,36 @@ module.exports = function(options, emitter) {
emitter
.
emit
(
'warn'
,
chalk
.
green
(
'Rendering Complete, saving .css file...'
));
emitter
.
emit
(
'warn'
,
chalk
.
green
(
'Rendering Complete, saving .css file...'
));
mkdirp
(
path
.
dirname
(
options
.
dest
),
function
(
err
)
{
mkdirp
(
path
.
dirname
(
destination
),
function
(
err
)
{
if
(
err
)
{
if
(
err
)
{
return
emitter
.
emit
(
'error'
,
chalk
.
red
(
err
));
return
emitter
.
emit
(
'error'
,
chalk
.
red
(
err
));
}
}
fs
.
writeFile
(
options
.
dest
,
result
.
css
.
toString
(),
function
(
err
)
{
fs
.
writeFile
(
destination
,
result
.
css
.
toString
(),
function
(
err
)
{
if
(
err
)
{
if
(
err
)
{
return
emitter
.
emit
(
'error'
,
chalk
.
red
(
err
));
return
emitter
.
emit
(
'error'
,
chalk
.
red
(
err
));
}
}
emitter
.
emit
(
'warn'
,
chalk
.
green
(
'Wrote CSS to '
+
options
.
dest
));
emitter
.
emit
(
'warn'
,
chalk
.
green
(
'Wrote CSS to '
+
destination
));
emitter
.
emit
(
'write'
,
err
,
options
.
dest
,
result
.
css
.
toString
());
emitter
.
emit
(
'write'
,
err
,
destination
,
result
.
css
.
toString
());
done
();
done
();
});
});
});
});
if
(
options
.
sourceMap
)
{
if
(
sourceMap
)
{
todo
++
;
todo
++
;
mkdirp
(
path
.
dirname
(
options
.
sourceMap
),
function
(
err
)
{
mkdirp
(
path
.
dirname
(
sourceMap
),
function
(
err
)
{
if
(
err
)
{
if
(
err
)
{
return
emitter
.
emit
(
'error'
,
chalk
.
red
(
err
));
return
emitter
.
emit
(
'error'
,
chalk
.
red
(
err
));
}
}
fs
.
writeFile
(
options
.
sourceMap
,
result
.
map
,
function
(
err
)
{
fs
.
writeFile
(
sourceMap
,
result
.
map
,
function
(
err
)
{
if
(
err
)
{
if
(
err
)
{
return
emitter
.
emit
(
'error'
,
chalk
.
red
(
'Error'
+
err
));
return
emitter
.
emit
(
'error'
,
chalk
.
red
(
'Error'
+
err
));
}
}
emitter
.
emit
(
'warn'
,
chalk
.
green
(
'Wrote Source Map to '
+
options
.
sourceMap
));
emitter
.
emit
(
'warn'
,
chalk
.
green
(
'Wrote Source Map to '
+
sourceMap
));
emitter
.
emit
(
'write-source-map'
,
err
,
options
.
sourceMap
,
result
.
map
);
emitter
.
emit
(
'write-source-map'
,
err
,
sourceMap
,
result
.
map
);
done
();
done
();
});
});
});
});
...
...
test/cli.js
View file @
02a3712d
...
@@ -335,6 +335,31 @@ describe('cli', function() {
...
@@ -335,6 +335,31 @@ describe('cli', function() {
},
200
);
},
200
);
},
500
);
},
500
);
});
});
it
(
'should compile all changed files in watched directory'
,
function
(
done
)
{
var
destDir
=
fixture
(
'watching-css-out/'
);
var
srcDir
=
fixture
(
'watching/'
);
var
srcFile
=
path
.
join
(
srcDir
,
'foo.scss'
);
fs
.
writeFileSync
(
srcFile
,
''
);
var
bin
=
spawn
(
cli
,
[
'--output-style'
,
'compressed'
,
'--output'
,
destDir
,
'--watch'
,
srcDir
]);
setTimeout
(
function
()
{
fs
.
appendFileSync
(
srcFile
,
'body{background:white}
\
n'
);
setTimeout
(
function
()
{
bin
.
kill
();
var
files
=
fs
.
readdirSync
(
destDir
);
assert
.
deepEqual
(
files
,
[
'foo.css'
,
'index.css'
]);
rimraf
.
sync
(
destDir
);
done
();
},
200
);
},
500
);
});
});
});
describe
(
'node-sass in.scss --output out.css'
,
function
()
{
describe
(
'node-sass in.scss --output out.css'
,
function
()
{
...
...
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