kottenator / kottenator/node-sass-watcher
Unable to rebuild sass
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the simplified JavaScript example in the issue and reproduce the hang after the watcher emits its update event. Inspect the node-sass-watcher update path and compare it with the working init path. Done means an update rebuild reaches sass.render(), writes the output, and completes on the reported setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100