Friday, 17 March 2017

How can I debug why Sass compilations are wildly varying in time?

For some reason, the compilation times for my Grunt watch task is varying from 1500ms to close to a minute. I would like to enquire into why, but I am not totally sure how to debug it. This is the function the watch task is triggering:

function buildSass(cb, isWatch) {
    const start = Date.now();
    isWatch && process.stdout.write(`Compiling SASS ...`);

    var gulpTask = gulp
        .src(input)
        .pipe($.plumber())
        .pipe($.sass(sassOptions))

    return gulpTask.pipe(gulp.dest(output))
        .on('end', ()=>
            isWatch && console.log(`finished after ${Date.now()-start} ms!`));
}

Below are the logs that are output from this task:

[10:54:33.914Z] change event for _remove.scss. Compiling SASS ...finished after 6169 ms!
[08:16:00.245Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 5890 ms!
[08:16:06.136Z] change event for _remove.scss. Compiling SASS ...finished after 1718 ms!
[08:16:47.460Z] change event for _subnav.scss. Compiling SASS ...finished after 6028 ms!
[08:16:53.534Z] change event for _subnav.scss. Compiling SASS ...finished after 1434 ms!
[08:29:49.449Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 25403 ms!
[08:30:14.856Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 1538 ms!
[08:30:43.603Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 17713 ms!
[08:37:19.010Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 20041 ms!
[08:38:26.867Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 150657 ms!
[08:40:57.528Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 2403 ms!
[08:45:23.739Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 46224 ms!
[08:52:09.589Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 24269 ms!
[08:58:46.721Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 21386 ms!
[09:01:17.893Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 10012 ms!
[09:01:27.906Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 1943 ms!
[09:01:38.379Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 11158 ms!
[09:01:49.537Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 1545 ms!
[09:02:20.393Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 9775 ms!
[09:02:30.206Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 1747 ms!
[09:03:14.869Z] change event for _webshopcampaign.scss. Compiling SASS ...finished after 36172 ms!



via oligofren

No comments:

Post a Comment