Skip to content

Commit

Permalink
Avoid sharing _options across multiple streams (#69)
Browse files Browse the repository at this point in the history
Before this commit, variable _options is sharing multiple streams.
It causes problems. _options.rebaseTo that was always set first is used.

If we have below files and gulpfile.js, rebaseTo was always `<PROJECT_ROOT>/scss/entries/lp/lp1/css`, and never `<PROJECT_ROOT/scss/entries/lp/lp2/subpage/css>`

```
scss/entries/lp/lp1/css/index.scss
scss/entries/lp/lp2/subpage/css/index.scss

gulp
  .src('scss/entries/**/*.scss')
  .pipe(plumber())
  .pipe(sass())
  .pipe(cleanCSS()) // rebaseTo always 'scss/entries/apps/app1/css/',
  .pipe(gulp.dest('public/'));
```
  • Loading branch information
troter authored and scniro committed Apr 23, 2019
1 parent 0cffc4d commit 7296d35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ const through = require('through2');

module.exports = (options, callback) => {

let _options = Object.assign({}, options || {});
let _callback = callback || (o => undefined);

return through.obj(function (file, enc, cb) {

let _options = Object.assign({}, options || {});

if (file.isNull()) {
return cb(null, file);
}
Expand Down

0 comments on commit 7296d35

Please sign in to comment.