Commit 2326b5f4 by xzyfer

Fix watching of entry points

Currently changes to non-partials are being picked up. This PR Fixes
that and adds addition test coverage.

Fixes #2139
parent 6c5f1101
...@@ -250,8 +250,6 @@ function watch(options, emitter) { ...@@ -250,8 +250,6 @@ function watch(options, emitter) {
}); });
}; };
watcher.reset(options);
var gaze = new Gaze(); var gaze = new Gaze();
gaze.add(watcher.reset(options)); gaze.add(watcher.reset(options));
gaze.on('error', emitter.emit.bind(emitter, 'error')); gaze.on('error', emitter.emit.bind(emitter, 'error'));
......
var grapher = require('sass-graph'), var grapher = require('sass-graph'),
clonedeep = require('lodash.clonedeep'), clonedeep = require('lodash.clonedeep'),
path = require('path'),
config = {}, config = {},
watcher = {}, watcher = {},
graph = null; graph = null;
...@@ -30,8 +31,14 @@ watcher.changed = function(absolutePath) { ...@@ -30,8 +31,14 @@ watcher.changed = function(absolutePath) {
this.reset(); this.reset();
if (absolutePath && path.basename(absolutePath)[0] !== '_') {
files.changed.push(absolutePath);
}
graph.visitAncestors(absolutePath, function(parent) { graph.visitAncestors(absolutePath, function(parent) {
files.changed.push(parent); if (path.basename(parent)[0] !== '_') {
files.changed.push(parent);
}
}); });
graph.visitDescendents(absolutePath, function(child) { graph.visitDescendents(absolutePath, function(child) {
...@@ -50,7 +57,7 @@ watcher.added = function(absolutePath) { ...@@ -50,7 +57,7 @@ watcher.added = function(absolutePath) {
this.reset(); this.reset();
if (Object.keys(graph.index).indexOf(absolutePath) !== -1) { if (Object.keys(graph.index).indexOf(absolutePath) === -1) {
files.added.push(absolutePath); files.added.push(absolutePath);
} }
...@@ -69,7 +76,9 @@ watcher.removed = function(absolutePath) { ...@@ -69,7 +76,9 @@ watcher.removed = function(absolutePath) {
}; };
graph.visitAncestors(absolutePath, function(parent) { graph.visitAncestors(absolutePath, function(parent) {
files.changed.push(parent); if (path.basename(parent)[0] !== '_') {
files.changed.push(parent);
}
}); });
if (Object.keys(graph.index).indexOf(absolutePath) !== -1) { if (Object.keys(graph.index).indexOf(absolutePath) !== -1) {
......
@import "partials/three";
.one { .one {
color: darkred; color: darkred;
} }
@import "partials/three";
.two { .two {
color: darkblue; color: darkblue;
} }
@import "partials/two";
.two { .two {
color: blue; color: blue;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment