klei/gulp-inject

no files injected when setting the options.name property.

Opened this issue · 4 comments

When using the name option, I get a gulp-inject Nothing to inject into index.tpl.html.
It work well using the starttag option

Please provide an example of how your index.tpl.html looks like and also a snippet of how you're using gulp-inject

the index.tpl.html is below:

<body>
    <!-- Header - Public Navigation -->
    <si-header menu="menu" fixed="fixPageHeader()"></si-header>

    <!-- Main page content -->
    <div id="page-content" ng-style="pageContentStyle()">
        <ui-view></ui-view>
    </div>

    <!-- Footer -->
    <si-footer menu="menu"></si-footer>

    <!-- Scripts -->
    <!-- inject:vendors:js -->
    <!-- endinject -->
</body>

here is a snippet of the gulp task

gulp.task('html', ['css', 'vendorjs', 'templatesjs', 'scripts', 'config'],  function () {
  del.sync([config.buildDir + '/index.html']);
  /* */
  var vendorJs = gulp.src([config.buildDir + '/vendor*'], { read: false });
  /* */
  return gulp.src(config.appIndexHtmlTpl)
    .pipe(inject(vendorJs, {removeTags: true, ignorePath: '/build', addRootSlash: false, name: 'vendors'} ))
    .pipe(rename('index.html'))
    .pipe(gulp.dest(config.buildDir));
});

Nothing is injected
image

But it works fine when I use the starttag option.
Thanks

Have you tried to use <!-- vendors:js --> instead of <!-- inject:vendors:js --> as open tag?

Refer to Basic usage option name example

@PeresZapfack: The solution @develmts suggests should work.