Stops writing CSS after first error in SASS
See original GitHub issueFirst, I’ve reported this issue under floatdrop/gulp-watch#86 thinking it was related to gulp-watch
, but then I’ve realized that the issue is gone when I replace gulp-sass
with gulp-less
, so I thought maybe this is a gulp-sass
related issue after all.
TL;DR: gulp-sass()
stops piping files to destination after a SASS error occurs. Need to restart gulp for the problem to go away.
Detail:
- When SASS files are error free, I see ‘Writing sass’ message each time I update a
*.scss
file. - Then, I deliberately introduce an error into one of the SASS files. I see an error message from
gulp-plumber
as I should. - However, when I undo this error, I no longer see “Writing sass” message and no CSS files are being written to the
.build/
directory. I need to restartgulp watch-sass
task to make things go back to normal.
# In gulpfile.coffee
sass = require("gulp-sass")
... ... ...
gulp.task "watch-sass", ->
watch
glob: filePath.appDir + "/**/*.scss"
.pipe plumber()
.pipe sass() # the problem goes away if I replace `sass` with `less`
.pipe using prefix: "Writing sass"
.pipe gulp.dest('.build/')
return
Issue Analytics
- State:
- Created 9 years ago
- Reactions:3
- Comments:23 (1 by maintainers)
Top Results From Across the Web
use in sass causes errors - css - Stack Overflow
I am having troubles with SASS @use. How does css file contain the @use from SASS? And it keeps saying $font-size is not...
Read more >Sass: @use
The @use rule loads mixins, functions, and variables from other Sass stylesheets, and combines CSS from multiple stylesheets together.
Read more >first-child - CSS: Cascading Style Sheets - MDN Web Docs
The :first-child CSS pseudo-class represents the first element among a group of sibling elements.
Read more >CSS, SCSS, and Less support in Visual Studio Code
Visual Studio Code has built-in support for editing style sheets in CSS .css , SCSS .scss and Less .less . In addition, you...
Read more >:not | CSS-Tricks - CSS-Tricks
The :not() property in CSS is a negation pseudo class and accepts a ... although its supported is growing at the time of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just re-tested this and it seems to be working fine when using
.on('error', sass.logError)
. Can someone double check this for me? @dlmanning @Keats @demisxSpecifically, what I was running is as follows:
Running
sass:watch
Hi, I found this issue after researching a bit about how to use
gulp-sass
with plumber. I understood that in order to keep the watch task alive I need to either:return
statement for the pipeHowever I don’t think this is an optimal solution because either you loose:
return
and don’t thus don’t return the streamAnd both of them are great advantages of gulp which I don’t want to loose when I’m using gulp-sass.
Minimal case, where returning the stream is beneficial for the overall execution time:
What do you guys think? I’m switching from
gulp-ruby-sass
togulp-sass
and I would really like to see this working ingulp-sass
as well!