In my application I am using gulp-inject
but I am getting error while I run my gulpfile.js
how to fix it?
console
:
PS F:\Nissan-Gulp> gulp
[14:38:38] Using gulpfile F:\Nissan-Gulp\gulpfile.js
[14:38:38] Starting 'server'...
[14:38:38] Finished 'server' after 22 ms
[14:38:38] Starting 'inject'...
[14:38:38] 'inject' errored after 19 ms
[14:38:38] Error in plugin 'gulp-inject'
Message:
There is no `read` option. Did you mean to provide it for `gulp.src` perhaps?
[14:38:38] Server started http://localhost:9000
[14:38:38] LiveReload started on port 35729
my code :
gulp.task( "inject", function( ) {
var sources = gulp.src(['./app/scripts/**/*.js', './app/stylesheets/**/*.css' ], {read: false}, {relative: true});
return gulp.src('./app/index.html')
.pipe(inject(sources, {
read: false,
ignorePath: '/app'
}))
.pipe(gulp.dest('./app'));
});
my html code :
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/stylesheets/main.css">
<!-- bower:css -->
<!-- endbower -->
<!-- inject:css -->
<!-- endinject -->
</head>
<body>
<!-- bower:js -->
<!-- endbower -->
<!-- inject:js -->
<!-- endinject -->
</body>
Change this:
to
Your sources variable already has the read option set - it is an option to gulp.src not gulp-inject. That is why it should be within the argument list for gulp.src as you correctly have it for var sources:
ignorePath is an inject option; read is not listed there. gulp-inject description