M
M
massef2015-06-17 12:07:08
JavaScript
massef, 2015-06-17 12:07:08

Gulp periodically "stumbles", how to cure?

I collect styles using Gulp, SASS is used.
The project is large, so I divided the styles into modules and import them into a common file.
When saving a file, Gulp periodically "stumbles" on compiling SASS, giving the following import error:

file to import not found or unreadable: ../utils/util

You wait a second, save again and everything is fine. Not to say that this is a problem, but very annoying.
Can this be fixed somehow?
The style sheet looks like this:
gulp.task('style', function () {
  gulp.src(path.src.style)
    .pipe(plumber())
    .pipe(sass())
    .pipe(prefixer({browsers: ['last 2 versions', 'ie 8']}))
    .pipe(minifyCSS())
    .pipe(gulp.dest(path.build.css))
    .pipe(reload({stream:true}));
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2015-06-17
@sim3x

try like this
.pipe(sass().on('error', sass.logError))

V
Valentin Dubrovsky, 2015-06-17
@matroskin13

Well, judging by your comment, the problem is in the path.src.style variable. It refers to all scss files, and you should have one main file (entry point). And in it you have to import other files.
For example, there is such a structure:
_content.scss
_article.scss
main.scss
Main.scss should contain the following code

import "content";
import "article";

And path.src.style = 'src/style/main.scss'.
But put your watcher on such a variable 'src/style/**/*.scss'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question