Gulp Sass compilation - optimization

24 views Asked by At

please, compiling my Sass takes 2-3 seconds, even if it is a three line file. I try to run the watch only on changed files and even if I have no other dependencies in the file, 2 sec seems very long to me.

Here is my Sass function:

function cssDevFunc() {
  return gulp.src(['./src/scss/**/*.scss', '!./src/scss/1-base.scss', '!./src/scss/bs/*.scss'], {base: './src/scss/'})
    .pipe(scss())
    .pipe(cached("sass_compile"))
    .pipe(gulp.dest('./www/css/'))
    .pipe(browsersync.stream());
}

And here is my watch function:

function watchFunc() {
  // nastavení BrowserSync:
  browsersync.init({
    proxy: settings.browsersync.url,
    browser: settings.browsersync.browser
  });

  gulp.watch( ['./src/scss/**/*.scss', '!./src/scss/1-base.scss', '!./src/scss/bs/*.scss'], cssDevFunc );
}

Here are my times:

[02:06:16] Starting 'cssDevFunc'...
[Browsersync] 1 file changed (test.css)
[02:06:19] Finished 'cssDevFunc' after 2.7 s
[02:06:24] Starting 'cssDevFunc'...
[Browsersync] 1 file changed (test.css)
[02:06:26] Finished 'cssDevFunc' after 2.26 s

In file test.sass is only this testing content:

.test {
  opacity: 0.3;
}

Do you see any possibility of optimization here? Thank you!

0

There are 0 answers