Reputation: 10714
I have the following Gulp task:
gulp.task('bowerinstall', function() {
gulp.src('app/index.html')
.pipe($.inject(gulp.src(bowerFiles(), {read: false}), {name: 'bower'}))
.pipe(gulp.dest(['dist/', 'app/']));
});
This task looks at my index.html and injects bower files into it. This works fine, however it injects the following paths into my index.html:
<script src="/app/bower_components/modernizr/modernizr.js"></script>
It's good that the task has identified the correct resource to inject into my application, but I'd like it to inject the following instead:
<script src="bower_components/modernizr/modernizr.js"></script>
Is there a way to modify my gulp task to do this?
Thanks!
Upvotes: 1
Views: 42
Reputation: 1592
In the following line:
.pipe($.inject(gulp.src(bowerFiles(), {read: false}), {name: 'bower'}))
Add the option relative: true
, eg:
.pipe($.inject(gulp.src(bowerFiles(), {read: false}), {name: 'bower', relative: true}))
This is covered by the documentation: https://www.npmjs.com/package/gulp-inject#injecting-files-relative-to-target-files
Upvotes: 1