Skip to content

unusually long compile time on a project #338

Description

@1stevengrant

Can anyone shed any light as to why Gulp would be taking so long to compile our Compass project?

When we run gulp compass

gulp.task('compass', function() {
    gulp.src('./docroot/sites/all/themes/pmc/sass/*.scss')
        .pipe(compass({
            config_file: './docroot/sites/all/themes/pmc/compass/config.rb',
            css: './docroot/sites/all/themes/pmc/css',
            sass: './docroot/sites/all/themes/pmc/sass'
        }))
        .pipe(gulp.dest('./docroot/sites/all/themes/pmc/css'));
});

we get

[gulp] Starting 'compass'...
[gulp] Finished 'compass' after 4.22 ms

but it actually takes about 1 min 50 to build our stylesheets

Doing a compass compile is actually much quicker.

Now I suspect this is project related as I've used Gulp on other projects and haven't seen the same issue. I wonder if our use of https://github.com/restorando/compass-retinator is causing the performance lag -- even so, a compass compile with this is still fairly speedy.

Any ideas?

Activity

  1. ajoslin commented on Mar 10, 2014

    @ajoslin
    Contributor

    Your gulp.task has no way of knowing that the compass task isn't over yet.

    Try returning the gulp.src(...). Check out the docs on task for details on how this works: https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulptaskname-deps-fn

    Additionally, if you find gulp-compass is slow, try it out with child_process and see:

    var cp = require('child_process');
    gulp.task('compass', function(done) {
      cp.spawn('compass', ['compile', 'some-args'], {stdio: 'inherit'})
      .on('exit', function(code) {
        if (code) return done('Compass failed. Exit code: ' + code);
        done();
      });
    });
  2. yocontra commented on Mar 10, 2014

    @yocontra
    Member

    What @ajoslin said.

    Also FYI you can return a child_process.spawn since that is also a stream!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions