gulp-flatten
gulp-flatten copied to clipboard
TypeError: Cannot read property 'reduce' of undefined
Hey, thanks for the library.
I'm having issues using gulp-flatten. I am using
return gulp.src('./components/**/*.pug')
// .pipe(print())
.pipe(flatten())
.pipe(pug({ verbose : false }))
.pipe(gulp.dest("./../public/templates/"))
also tried
return gulp.src('./components/**/*.pug')
// .pipe(print())
.pipe(pug({ verbose : false }))
.pipe(flatten())
.pipe(gulp.dest("./../public/templates/"))
Both produce the following error:
TypeError: Cannot read property 'reduce' of undefined
at _flatten (/home/james/Code/3drepo.io/frontend/node_modules/flatten/index.js:14:16)
at flatten (/home/james/Code/3drepo.io/frontend/node_modules/flatten/index.js:11:10)
at Gulp.<anonymous> (/home/james/Code/3drepo.io/frontend/gulpfile.js:56:15)
at module.exports (/home/james/Code/3drepo.io/frontend/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/home/james/Code/3drepo.io/frontend/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/home/james/Code/3drepo.io/frontend/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/home/james/Code/3drepo.io/frontend/node_modules/orchestrator/index.js:134:8)
at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
Using: Node.js LTS 6.11.2 Gulp 3.9.1
Hey, @JamesMilnerUK
Sorry for late reply. Could you try following:
gulp.src('./components/**/*.pug')
.pipe(flatten())
.pipe(gulp.dest("./../public/templates/"))
Does it work?
I believe you tried using the flatten package, and not gulp-flatten.
npm install gulp-flatten --save-dev
var flatten = require('gulp-flatten');