Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use alongside data url loader for svgs in css files. #15

Open
IanBellomy opened this issue Apr 11, 2024 · 0 comments
Open

Use alongside data url loader for svgs in css files. #15

IanBellomy opened this issue Apr 11, 2024 · 0 comments

Comments

@IanBellomy
Copy link

IanBellomy commented Apr 11, 2024

Is there a way to use esbuild-plugin-svgr for svgs imported in js while having css urls passed through to a specified esbuild loader like dataurl?

As a work around, I added this chunk to the plugin's onLoad:

if (args.suffix === "?data") {
    return {
        contents: svg,
        loader: "dataurl",
    };
}

...and appended ?data to my .css svg paths.

I'd like to avoid modifying source to satisfy a build processes though. I'm also a little confused why onLoad is called for items flagged external regardless...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant