Reputation: 698
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/')));
};
Upvotes: 3
Views: 952
Reputation: 143
Found that updating gulp-inject to version 5.0.3 fixes the issue. https://github.com/klei/gulp-inject/pull/258
Upvotes: 6
Reputation: 698
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"
}
},
After reverting version of all required dependencies one by one I am able to fix this. It is due to [email protected] in my package-lock.json file.
"group-array": {
"version": "0.3.4",
"requires": {
"arr-flatten": "^1.0.1",
"for-own": "^0.1.4",
"get-value": "^2.0.6",
"kind-of": "^3.1.0",
"split-string": "^1.0.1",
"union-value": "^1.0.1"
}
Fixed it by adding post install script in my package.json file
"postinstall": "npm i [email protected] --save"
Upvotes: 4