Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Fix watching of CSS files to avoid infinite build cycle #1925

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bin/node-sass
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ function watch(options, emitter) {
}
});
files.forEach(function(file) {
if (path.basename(file)[0] !== '_') {
var fileName = path.basename(file);
if (fileName[0] !== '_' && (!options.sameInputAsOutput || fileName.slice(-4) !== '.css')) {
renderFile(file, options, emitter);
}
});
Expand Down Expand Up @@ -309,6 +310,8 @@ function run(options, emitter) {
if (!isDirectory(options.output)) {
emitter.emit('error', 'An output directory must be specified when compiling a directory');
}

options.sameInputAsOutput = path.resolve(options.directory) === path.resolve(options.output);
}

if (options.sourceMapOriginal && options.directory && !isDirectory(options.sourceMapOriginal) && options.sourceMapOriginal !== 'true') {
Expand Down