Skip to content

Commit

Permalink
The watch should watch indented syntax files too
Browse files Browse the repository at this point in the history
This fixes a bug that prevented the watcher from triggering file
compilations on changes to .sass file.

Fixes sass#1075
  • Loading branch information
xzyfer committed Aug 17, 2015
1 parent 6343cea commit b45a02e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/node-sass
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function getOptions(args, options) {
function watch(options, emitter) {
var watch = [];

var graphOptions = { loadPaths: options.includePath };
var graphOptions = { loadPaths: options.includePath, extensions: ['scss', 'sass', 'css'] };
var graph;
if (options.directory) {
graph = grapher.parseDir(options.directory, graphOptions);
Expand Down
25 changes: 24 additions & 1 deletion test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ describe('cli', function() {
}, 500);
});

it('should watch the full sass dep tree for a single file', function(done) {
it('should watch the full scss dep tree for a single file', function(done) {
var src = fixture('watching/index.scss');
var foo = fixture('watching/foo.scss');

Expand All @@ -311,6 +311,29 @@ describe('cli', function() {
}, 500);
});

it('should watch the full sass dep tree for a single file', function(done) {
var src = fixture('watching/index.sass');
var foo = fixture('watching/bar.sass');

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}');
bin.kill();
done();
});

setTimeout(function() {
fs.appendFileSync(foo, 'body\n\tbackground: white\n');
}, 500);
});

it('should watch whole directory', function(done) {
var destDir = fixture('watching-css-out/');
var srcDir = fixture('watching-dir/');
Expand Down

0 comments on commit b45a02e

Please sign in to comment.