esbuild icon indicating copy to clipboard operation
esbuild copied to clipboard

Way to just update relative url() when bundling CSS, don't move file - Propose "update-path" loader command line option

Open samwillis opened this issue 2 years ago • 0 comments

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" 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.

samwillis avatar May 06 '22 19:05 samwillis