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

Export the SVG files #29

Closed
simontaisne opened this issue Sep 6, 2022 · 2 comments
Closed

Export the SVG files #29

simontaisne opened this issue Sep 6, 2022 · 2 comments

Comments

@simontaisne
Copy link

Is there any way to import the SVGs directly from phosphor-react? I looked in the other Phosphor packages but couldn't find a way. For those using Next.js with SVGR this would allow such usage with dynamic import.

const svg = {
  heart: dynamic<SVGProps<SVGSVGElement>>(() =>
    import('phosphor-react/svgs/heart.svg').then((mod) => mod.ReactComponent)
  ),
  ...
}

const Icon = ({ icon, ...props }) => {
  const Svg = svg[icon];

  return <Svg {...props} />;
};
@rektdeckard
Copy link
Member

Unfortunately the raw SVGs are not included in the public NPM package -- it would more than double the download size and we don't think that's a nice thing to do for the common use-case. You can download the assets yourself from our website, or from the repo here, and do this quite easily without a package.

@rektdeckard
Copy link
Member

FYI we now have the @phosphor-icons/core package which exposes the assets as an NPM package.

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

2 participants