Problem description
When I use the code you provided in README.md with autoprefixer and postcss removed simplifying my testing it fails. Here is the simplified code:
var fs = require('fs');
var sass = require('node-sass');
var Watcher = require('node-sass-watcher');
// Input variables
var inputFile = process.argv[2];
var outputFile = process.argv[3];
// Options
var watcherOptions = {
verbosity: 3,
}
// Renderer
function render() {
console.warn('Rendering "' + inputFile + '" file...');
sass.render({file: inputFile}, function(err, result) {
if (err) {
console.error('Error: ' + err.message);
return;
}
console.warn('Outputting to "' + outputFile + '" file...');
fs.writeFile(outputFile, result.css);
});
}
// Start watching
var watcher = new Watcher(inputFile, watcherOptions);
watcher.on('init', render);
watcher.on('update', render);
watcher.run();
I first tried it in my app which works great when I use chokidar/fs.watchFile on a single scss file and then do sass.render() but hangs when the 'update' event is called (it starts, ends at console.warn before sass.render()). When I first launch the node app the 'init' event triggers and rebuild finishes without a problem.
Technical specification
OS: Ubuntu 18.04
node versions tested: 6.4.0, 8.11.2, 8.11.3
node-sass versions tested: 4.7.2, 4.9.2
node-sass-watcher version: 0.5.1
Problem description
When I use the code you provided in README.md with autoprefixer and postcss removed simplifying my testing it fails. Here is the simplified code:
I first tried it in my app which works great when I use chokidar/fs.watchFile on a single scss file and then do
sass.render()but hangs when the 'update' event is called (it starts, ends atconsole.warnbeforesass.render()). When I first launch the node app the 'init' event triggers and rebuild finishes without a problem.Technical specification