Gulp inject outputs, but none of the options are working

I am trying to use 'gulp-inject' plugin to add js files to my index file (Angular App).

The following is a portion of my gulpfile.js:

var source = 'src/'; var index = source + 'index.html'; var js = [     source + '**/*.module.js'     // More file paths ];  gulp.task('injectJs', function () {     return gulp         .src(index)         .pipe($.inject(gulp.src(js, {addRootSlash: false, ignorePath: ['src/']})))         .pipe(gulp.dest(source)); }); 

After I run the task, here is the portion in question of resulting index.html file:

<!-- inject:js -->     <script src="/src/js/app.module.js"></script> <!-- endinject --> 

According to the additional options set in the task, the output src should be 'js/app.module.js'.

Things I have tried, with no change in result:

  • Following some suggestions from the plugin's 'ignorePath' issue on github (click here)
  • Including only one option (i.e. addRootSlash or ignorePath)
  • Using {cwd: 'js/'} as the only option
  • Changing 'js' variable to a string (i.e. var js = source + '**/*.module.js')
  • Changing ignorePath to a string (i.e. ignorePath: 'src/')

Not sure what is wrong, or what else to try. Any help will be appreciated!

Replay

Category: javascript Time: 2016-07-31 Views: 11

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.160 (s). 12 q(s)