0

I'm using Gulp as my task runner, and gulp-ruby-sass to compile my sass files into css.

The error I'm getting on my gulp default task:

enter image description here

My default Gulp task:

gulp.task('default', ['delete', 'web_css', 'dash_css', 'web_js', 'dash_js']);

My 2 compile SASS tasks:

// Compile public SASS
gulp.task('web_css', function() {
    return sass('client/website/_sources/sass/bitage_web.scss', { style: 'compressed' })
        .pipe(sourcemaps.init())
        .pipe(sourcemaps.write('./maps'))
        .pipe(gulp.dest('client/website/assets/css'));
});

// Compile dashboard SASS
gulp.task('dash_css', function() {
    return sass('client/dashboard/_sources/sass/bitage_app.scss', { style: 'compressed' })
        .pipe(sourcemaps.init())
        .pipe(sourcemaps.write('./maps'))
        .pipe(gulp.dest('client/dashboard/assets/css'));
});

Both tasks above are virtually identically.

When I run the default task (gulp):

  1. The website css compiles ok
  2. All the js compiles ok
  3. But then I get that error before the dash_css finishes, and the css is not compiled :(

enter image description here

Additional notes:

  • If make a change in gulp watch the dash_css will compile just fine.
  • If I run just gulp dash_css it also compiles just fine.
  • I only have this Errno::ENOENT bug when I run the default task.

enter image description here

Do you see anything strange above? Or have run into this issue before?

4

2 回答 2

1

使用回调以便 gulp 知道任务何时完成:

gulp.task('delete', function(cb) {
    del([
        'client/website/assets/css/maps',
        'client/website/assets/css/bitage_web.css',
        'client/dashboard/assets/css/maps',
        'client/dashboard/assets/css/bitage_app.css',
        'client/website/assets/js/*',
        'client/dashboard/assets/js/*'
    ], cb);
});

delete其他任务之前运行,例如使用run-sequence

于 2015-02-24T02:01:34.010 回答
-1

我变了

gulp.task('web_css', function() {
    return sass(....

至:

gulp.task('web_css', function() {
    return gulp.src('
于 2016-12-06T12:30:07.173 回答