kazijawad / esbuild-plugin-svgr

An esbuild plugin for importing SVGs as React components.
https://npmjs.com/package/esbuild-plugin-svgr
MIT License
36 stars 12 forks source link

css url() and url src options #11

Closed smol-honk closed 1 year ago

smol-honk commented 1 year ago

Added url option for svgr. And updated to handle css url imports.

To import as a src in jsx or tsx:

import yourSvgUrl from './mySvg.svg?url';

It should automatically work for css imports as well.

For the package-lock.json update, it was to fix vulnerable dependencies with npm audit fix.

Related issues #10

This is my first time working with esbuild plugins, so let me know if I did something wrong!

kazijawad commented 1 year ago

Thank you for the PR! A minor nit — it looks like your changes also changed the formatting. Would you be able to revert the code formatting changes? This would make it easier to understand the diff.

smol-honk commented 1 year ago

@kazijawad Totally can do! Sorry about the formatting! Must be my prettier coming into play. Appreciate you looking at this 😄

kazijawad commented 1 year ago

Thank you for making those changes, this all looks good to me. I'm planning on testing these changes in a project this weekend and then will merge this.

kazijawad commented 1 year ago

Ok this looks good to me, I'll go ahead and merge this and release a minor version.