Sass Gulp Damaged

We have gulp running sass and a synchronization browser, and it works without problems for about 6 months. We have about 60 sass and scss that were compiled on the fly in CSS.

Everything went well and smoothly, and suddenly the front end compiler started throwing millions of errors - as if someone went into 75% of the sass files and added half columns, deleted spaces, moved spaces, and there was an error in the _media.scss file, which I didn’t understand.

How could this happen all of a sudden? I have no idea what to do now - I spent about 45 minutes trying to solve all the mistakes, but there are so many.

+5
source share
1 answer

With this problem, I found out that when gulp-sass crashes, it is probably due to a Sass or Scss syntax error caused by a wrong indent or something similar. This is probably not caused by damage to Gulp or Sass or gulp-Sass or another js plugin.

What a revelation.

This was not obvious to me, because I usually get sass syntax errors printed on the console, and I assumed that this would happen in all sass errors, but this error seemed to be more damaging because it loaded into the sass loop.

The only way to find an error is to disable all sass files one by one until sassgulp stops crashing. Then debug the failed file.

This helps debug if you split your sass / sass files and load into really small files and folders and include them in @import. Then you can easily comment on @import lines to find the file with the error.

In case you have this problem and you definitely don't have Sass errors (unlikely) -

Here is a random list of things that I was ready to try, which I found here https://github.com/sass/node-sass/issues/918 :

1. Initially, I thought I fixed it by uninstalling and reinstalling gulp-sass.

  1. Completely removes the node_modules directory and does a new npm installation
  2. Doing npm uninstall Gulp and gulp-sass, then the new npm install
  3. Performing a global installation of node-sass and globally uninstalling node-sass.
  4. Running npm rebuild node-sass from the node_modules / gulp-sass directory
  5. Performing an npm install using node-sass @ 2, then node-sass @ 3 if that didn't work
  6. A few times knocking my head on my desk
+2
source

Source: https://habr.com/ru/post/1238093/


All Articles