klei / gulp-inject

A javascript, stylesheet and webcomponent injection plugin for Gulp
MIT License
811 stars 93 forks source link

[Error] When empty is true, replace endTag by startTag #224

Closed 11joselu closed 7 years ago

11joselu commented 7 years ago

See #L147

Code example (inyecting into jsp file):

pipe($.inject(src(file), {
        relative: true,
        empty: true,
        starttag: '<%-- analytics:{{ext}} --%>',
        endtag: '<%-- endanalytics --%>'
      }))
slhenty commented 7 years ago

I have the same problem... and I've discovered where the bug is (line 147 in https://github.com/klei/gulp-inject/blob/master/src/inject/index.js)

Currently is:

    var endTag = getTagRegExp(opt.tags.end(targetExt, ext, opt.starttag), ext, opt);

Should be:

    var endTag = getTagRegExp(opt.tags.end(targetExt, ext, opt.endtag), ext, opt);

I'm planning to start the fix and submit a PR, ASAP.