A
A
ANDREW_TUR2018-07-31 11:33:23
Node.js
ANDREW_TUR, 2018-07-31 11:33:23

Gulp-sass in conjunction with node.js is a long compilation, and Node began to fill up all the free RAM. What's wrong?

Hello!
Here such piece happened:
There is a project - styles I write as well as everything on SASS.
I use Gulp-sass for this.
there are about 20 *scss files that compile into one style.css
At first, the compilation time was about 7 seconds.
The project has grown - now it takes 4 - 6 minutes to compile all the files into the final one (depending on the machine on which this magic is done)
+ during compilation, Node eats all the free memory that is. On the laptop 8GB .... 3GB is free and Node takes them for itself, showing the fact to all other processes in my system.)) I used to be more modest (I'm talking about Node.exe) I have
32 on my computer and guess what - it eats 16GB ... 16 GB Carl)) (my forever open programs eat the rest)
here is a screenshot from the task manager on the laptop5b602103ed353854491688.png
Here is the task itself with gulp js:

gulp.task('styles', function () {
    return gulp.src(config.scss)
    // .pipe(sourcemaps.init())
        .pipe(sass().on('error', sass.logError))
        .pipe(autoprefixer('last 3 versions'))
        .pipe(minifycss())
        .pipe(rename({suffix: '.min'}))
        .pipe(gulp.dest('' + config.css + ''))
        .pipe(reload({stream: true}));
});

Here is the result of working from the terminal (cmd):
5b6026a84a3c7650146105.png
Here are the dependencies with package.json:
5b60286531609034242662.pngQuestion: Does everyone have this or what is it and how to deal with it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Flying, 2018-07-31
@ANDREW_TUR

Offhand what you can try:
1. Remove the constant minification of css, anyway, it is not useful for development, but only eats time and worsens the readability of the result. Make a separate task, for example "prod" where to put all the optimization tasks (by the way, you can also connect css-mqpacker , it helps a lot)
2. Try to disable the browserSync call, it's not a fact that it will help, but for the purity of the experiment - it's worth a try.
3. Try alternative libraries:
- gulp-connect instead of browsersync
- gulp-csso instead of gulp-minify-css
4. Try changing the version of node.js, the easiest way to experiment with this is through nvm or for windows -nvm-windows .
5. Try to look at what is happening through inspect node.js mode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question