1

When I run the my task it says files are injected to index.html in the console; but there is no js files injected in the index.html file actually.

my task functions is as follow

gulp.task('testing', function() {
  gulp.src('../dist/app/index.html')
  .pipe(debug())
  .pipe(inject(gulp.src('../dist/app/js/*.js', {read: false}), {relative: true}))
  .pipe(debug())
  .pipe(gulp.dest('../dist/app/js'));
});

I am using gulp3.9.1 and gulp-inject version 3.0.0, any help is advance appreciated.

2
  • Comparing this to my setup, my gulp.src files are in an array, try: ...gulp.src(['../dist/app/js/*.js'], ... (I'm not sure, but this is easy to try.) Commented Mar 8, 2018 at 4:01
  • We will need to see the relevant part of your html as well. Commented Mar 8, 2018 at 19:13

1 Answer 1

1

It seems like the destination path specified points to js directory '../dist/app/js' See if the new file is in js folder. If yes, you probably don't want /js part in the path

Also you can try to add

<!-- inject:js -->
<!-- endinject -->

into you index.html at the place where you want your js scripts to be injected

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.