Possible to dynamically inject files depends on the name of file to be injected ?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 807
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
I have a huge HTML file, with many files to inject, but it seems not DRY to do this:
``` javascript
var myTransform = function (filepath, file) {
return file.contents.toString('utf8');
};
gulp.src('target.html')
.pipe(inject(gulp.src('file1.html'), { starttag: ''), transform: myTransform))
.pipe(inject(gulp.src('file2.html'), { starttag: ''), transform: myTransform))
.pipe(inject(gulp.src('file3.html'), { starttag: ''), transform: myTransform))
.pipe(inject(gulp.src('file4.html'), { starttag: ''), transform: myTransform))
.pipe(inject(gulp.src('file5.html'), { starttag: ''), transform: myTransform))
.pipe(inject(gulp.src('file6.html'), { starttag: ''), transform: myTransform))
.pipe(inject(gulp.src('file7.html'), { starttag: ''), transform: myTransform))
.pipe(inject(gulp.src('file8.html'), { starttag: ''), transform: myTransform))
.pipe(inject(gulp.src('file9.html'), { starttag: ''), transform: myTransform))
;
```
Any way to eliminate the duplication? Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the plugin's injection-marker handling and the repeated gulp.src/inject calls shown in the issue. Determine how a marker name could relate to its source file, then identify the relevant tests or entry point and define completion as removing the duplicated pipeline setup while preserving each file's injected content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100