Skip to content

Injections using opt.name in files without tag still output results #184

@ccampanale

Description

@ccampanale

I may be missing something but I've searched and can't seem to find any information on this, so if I'm nuts please just point me in the right direction:

As the title says, injections using opt.name in files without the named tag still output results that files were inject while this is - from my perspective - technically incorrect.

Example task:

var sitefiles = {
  login: {
    css: [
      'userportal/assets/css/*.css',
    ],
    js: [
      'userportal/assets/js/jquery-1.8.3.min.js',
    ]
  },
  header: {
    css: [
      'userportal/assets/css/*.css',
    ],
    js: [
      'userportal/assets/js/jquery*.js',
    ]
  }
}

gulp.task('revreplace', 'Inject all prepared stylesheets and scripts into application code for fresh build', ['scripts', 'styles'], function(){
  return gulp.src('./userportal/*.php')
    .pipe(inject(gulp.src(sitefiles.header.css, {read: false}), {name: 'head',  relative: true}))
    .pipe(inject(gulp.src(sitefiles.login.css,  {read: false}), {name: 'login', relative: true}))
    .pipe(inject(gulp.src(sitefiles.header.js,  {read: false}), {name: 'head',  relative: true}))
    .pipe(inject(gulp.src(sitefiles.login.js,   {read: false}), {name: 'login', relative: true}))
    .pipe(gulp.dest('userportal'));
});

As you can see this task uses a gulp.src that is a glob of files and I am using an object sitefiles to define some dynamic and static file locations to inject into specific files as they are found. In this example only the login.php and header.php actually have named tags for injection in them while the rest of the parsed php files do not (yet). So really only a handful of files - both .css and .js - get injected ONLY into these two files while the rest of the files get nothing injected however I still see output for other files that reads [21:19:45] gulp-inject 3 files into index.php. for instance.

I feel like this should not be the case but can't see how to suppress this other then setting opt.quiet:true but I rather like getting the output for which files received injections just not if it's not really got information for me and reports on all the files.

Again, please set me straight if I'm bat-shit-crazy. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions