Inject/transform image paths?
- Dominant language
- JavaScript
- Stars
- 807
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
Is it possible to use gulp-inject to rewrite image paths? I am using gulp-inject to modify the paths of css files to replace the domain for local vs test environments like so:
```
//...
.pipe(inject(css, {addPrefix: cdnPrefix, addRootSlash: false}))
```
This transforms the css file to:
```
```
I am attempting to use this same method to rewrite the paths of image files using the `options.name` property, like so:
```
//...
.pipe(inject(css, {addPrefix: cdnPrefix, addRootSlash: false}, {name: 'images'}))
```
However the image tags in this region are not being transformed. In reading through the documentation, I have only seen examples using JavaScript and CSS files... Is this part of gulp-inject, or should it be able to handle any filetype? If so, is there documentation around injecting/transforming file paths like I am attempting?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the gulp-inject documentation examples for JavaScript and CSS, then examine how the `name: 'images'` region and `addPrefix` option are handled. Reproduce the reported HTML example and determine whether image-path rewriting is supported; done means documenting the supported behavior or a clear limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100