Way to just update relative url() when bundling CSS, don't move file - Propose "update-path" loader command line option
- Dominant language
- Go
- Stars
- 40.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Currently when bundling CSS if you only want to update the relative path in the `url()` and not move the file you have to use the plugin api as in: https://github.com/evanw/esbuild/issues/800.
I'm building a tool for Python/Django developers and my intention is that they will not need to setup a node.js environment to use it[^1]. What I would love would be a built in `update-path` loader, so you could pass an argument to the command line such as `--loader:.png=update-path ` or even better a way to pass a ["ResolveKind"](https://esbuild.github.io/plugins/#resolve-options) to the option, such as `--loader:[url-token]=update-path`.
Using `--external:*.png` is not an option as it does not update the relative path, leaving it as is.
Would something like this be possible?
(P.s. esbuild is incredible!)
[^1]: It will automatically download the correct esbuild binary for their os/platform.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with esbuild's plugin API and the command-line loader handling described in the issue, then compare that with the ResolveKind and --external behavior. Done means a built-in update-path loader or equivalent option updates relative url() paths while leaving the referenced files unmoved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- build-system, cli, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100