mathisonian / gulp-sass-bulk-import

gulp task to allow importing directories in your SCSS
MIT License
41 stars 11 forks source link

Callback firing too soon #9

Open KittyGiraudel opened 9 years ago

KittyGiraudel commented 9 years ago

Consider the following task:

gulp.task('sass', function () {
  return gulp
    .src('./assets/stylesheets/*.sass')
    .pipe(glob())
    .pipe(sass())
    .pipe(gulp.dest(output));
});

And the following files in stylesheets/:

// a.sass
@import "b.sass";
// b.sass
@import "sub/*"

Now, here is what happens:

  1. The plugin starts with a.sass and does not find any glob
  2. The callback from a.sass is being fired and the next task (Sass) starts processing the files
  3. The plugin moves on to b.sass
  4. Sass starts with a.sass and follows the import statement
  5. Sass stumbles upon sub/* in b.sass before the plugin has replaced it
  6. An error occurs:
  events.js:85
        throw er; // Unhandled 'error' event
              ^
  Error: assets/stylesheets/b.sass
    6:9  file to import not found or unreadable: sub/*

Any idea?

denisborovikov commented 9 years ago

It could be related to #5, gulp-sass-bulk-import doesn't follow nested imports.

Gottwik commented 8 years ago

The problem with this is that only a.sass is in the vinyl. No way to modify nested files elsewhere.