Closed hansmbakker closed 9 years ago
solution: line 67:
files.forEach (function(file) {
var parts = file.split('.');
if (['scss', 'sass'].indexOf(last(parts)) === -1) return;
var name = last(parts[0].split('/'));
var fullPath = path.join(path.join(opts.project, opts.sass), file);
var cssPath = path.join(path.join(opts.project, opts.css), name) + '.css';
if (!cache[cssPath]) return;
need++;
fs.stat(fullPath, getSassFunction(fullPath, cssPath, doneFunction));
});
line 232:
files.forEach(function(file) {
if (last(file.split('.')) === 'css') {
need++;
var full = path.join(path.join(opts.project, opts.sass), file);
fs.readFile(full, getCSSFunction(full, doneFunction));
}
});
While this is in a current rewrite, I think I'll write a patch for the current version to fix this now.
This has nothing to do with the node version I think.
I think the middleware can't find your compass project files.
Right now it just assumes they're there. I'll work on fixing that.
Try now. This is fixed in node-compass@0.2.4
I believe it was actually failing because you've misconfigured it but it'll tell you that if it is. Regardless, I've incorporated your "fix" because its just nicer code.
I did console.log(files) and it contained an array ['style.scss', 'style.css'] instead of the files object that version 0.2.3 expected.
I haven't changed any configuration about fs.readDir and as documented here http://nodejs.org/api/fs.html#fs_fs_readdir_path_callback, fs.readDir returns an array of filenames on v0.12.0.
Thank you for fixing it, though :)
using node-compass 0.2.3
On index.js@line 233 there is a loop over the properties of a files object.
However, on node 0.12 this files object is just an array - you can do a forEach here.
The code expecting an object crashes here: