klei/gulp-inject

Gulp Inject not injecting all my files. Adding only one main.scss file

ibtesamlatif2997 opened this issue · 4 comments

Hi,

I am facing the issue from yesterday in gulp inject after rebuild, gulp-inject not injecting all my files. Adding only one main.scss file

Didn't changed anything in gulp styling task. Same code is working on my stage environment because I didn't rebuild the gulp.

Here is the code snippet.

  var injectFiles = gulp.src([
    path.join(conf.paths.src, '/sass/**/_*.scss'),
    '!' + path.join(conf.paths.src, '/sass/theme/conf/**/*.scss'),
    '!' + path.join(conf.paths.src, '/sass/404.scss'),
    '!' + path.join(conf.paths.src, '/sass/auth.scss')
  ], {read: false});

  var injectOptions = {
    transform: function (filePath) {
      filePath = filePath.replace(conf.paths.src + '/sass/', '');
      return '@import "' + filePath + '";';
    },
    starttag: '// injector',
    endtag: '// endinjector',
    addRootSlash: false
  };

  return gulp.src([
    path.join(conf.paths.src, '/sass/main.scss')
  ])
    .pipe($.inject(injectFiles, injectOptions))
    .pipe(wiredep(_.extend({}, conf.wiredep)))
    .pipe($.sourcemaps.init())
    .pipe($.sass(sassOptions)).on('error', conf.errorHandler('Sass'))
    .pipe($.autoprefixer()).on('error', conf.errorHandler('Autoprefixer'))
    .pipe($.sourcemaps.write())
    .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app/')));
};

Hi,

I face the same issue, it seems to come from the group-array dependency of gulp-inject. This version has been updated a few days ago, and since this version gulp-inject seems to not behave the same way as before.

With group-array@0.3.3 everything went well, but with v0.3.4 only the main.scss is injected.

After evaluating the package-lock.json file. Following dependencies are required by gulp-inject

"gulp-inject": {
  "requires": {
    "arrify": "^1.0.1",
    "escape-string-regexp": "^1.0.5",
    "event-stream": "^3.1.0",
    "group-array": "^0.3.0",
    "gulp-util": "^3.0.0",
    "stream-to-array": "^2.3.0",
    "through2": "^2.0.1"
  }
},

Fixed by adding this
https://stackoverflow.com/questions/57076199/gulp-inject-not-injecting-all-my-files-adding-only-one-main-scss-file

Thanks !

FYI, the PR258 seems to fix the version of group-array.

rejas commented

hi guys and girls, v5.0.3 should fix your problems since group-array is pinned to v0.3.3 in it.