brunch / less-brunch

Adds LESS support to Brunch
14 stars 18 forks source link

less-brunch broken on most recent brunch release #20

Closed BernieSumption closed 9 years ago

BernieSumption commented 9 years ago

It seems that the current version of less-brunch is broken with the current version of brunch. I have found the cause of the bug and got a fix that works on my machine, but I don't know enough about brunch internals to know if this is the right fix.

To reproduce, create any brunch project and try to build it:

npm install -g brunch
mkdir bug-demo
cd bug-demo
brunch new gh:brunch/dead-simple
npm install --save less-brunch
touch app/style.less
brunch build

Results in the following error

TypeError: Cannot read property 'regexp' of undefined
  at LESSCompiler.progeny [as getDependencies] (/Users/bernie/Documents/Projects/bug-demo/node_modules/less-brunch/node_modules/progeny/lib/index.js:182:19)
  at getDependencies (/usr/local/lib/node_modules/brunch/lib/fs_utils/pipeline.js:40:23)
  ... 15 more lines ...

The problem is this line in less-brunch's index.js on line 12:

  this.getDependencies = progeny({rootPath: this.rootPath});

brunch expects getDependencies to be a function(data, path, callback) but progeny provides a function(path, source, callback), so it tries to treat the LESS script content as a file path and dies.

I resolved the issue on my machine by deleting the line. This works for my project, but I assume I must have broken something.

A more appropriate fix might be something like:

  this.getDependencies = function(data, path, callback) {
    return progeny({rootPath: this.rootPath})(path, data, callback);
  };
es128 commented 9 years ago

Sorry, careless error on my part. Thanks for reporting it. Fix coming shortly.

BernieSumption commented 9 years ago

Yup, working for me again. Thanks for the rapid fix!