dlmanning / gulp-sass

SASS plugin for gulp
MIT License
1.57k stars 381 forks source link

Gulp-sass crashes when there is a CSS variable #732

Closed TECHNOFAB11 closed 2 years ago

TECHNOFAB11 commented 5 years ago

So when i add the following code, gulp-sass crashes. Plumber shows the error, and even crashes completely (exactly what Plumber should prevent). This is the code:

#nav {
 --height: 10vh;
 height: var(--height);
}

This results in this Error:

[18:13:12] Plumber found unhandled error:
 Error in plugin "sass-lint"
Message:
    Cannot read property 'first' of null

/home/technofab/<path>/node_modules/sass-lint/index.js:70
  results.forEach(function (result) {
          ^
TypeError: Cannot read property 'forEach' of undefined
    at Function.sassLint.warningCount (/home/technofab/<path>/node_modules/sass-lint/index.js:70:11)
    at Function.sassLint.resultCount (/home/technofab/<path>/node_modules/sass-lint/index.js:88:23)
    at Function.sassLint.outputResults (/home/technofab/<path>/node_modules/sass-lint/index.js:274:12)
    at DestroyableTransform._transform (/home/technofab/<path>/node_modules/gulp-sass-lint/index.js:77:12)
    at DestroyableTransform.Transform._read (/home/technofab/<path>/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (/home/technofab/<path>/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:83)
    at doWrite (/home/technofab/<path>/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:428:64)
    at writeOrBuffer (/home/technofab/<path>/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:417:5)
    at DestroyableTransform.Writable.write (/home/technofab/<path>/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:334:11)
    at DestroyableTransform.ondata (/home/technofab/<path>/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:619:20)

These are the versions:

├─┬ gulp-sass@4.0.2
│ └── node-sass@4.11.0
davidrhoderick commented 5 years ago

I just had the same problem; the error is pretty annoying because there is no information, I had to debug all of Bootstrap to see what was the issue. Turns out, if you are trying to import bootstrap.scss, you will get this error because _root.scss has a bunch of those variables. Everything else in Bootstrap works, so hopefully you don't need _root.scss. Definitely needs a better error report and eventually, it should handle CSS variables.

XhmikosR commented 2 years ago

@xzyfer this doesn't seem related to gulp-sass either.