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

Why is blueprint-icons.ttf always requested? #6401

Closed
bitjson opened this issue Sep 22, 2023 · 2 comments
Closed

Why is blueprint-icons.ttf always requested? #6401

bitjson opened this issue Sep 22, 2023 · 2 comments

Comments

@bitjson
Copy link

bitjson commented Sep 22, 2023

Environment

  • Package version(s): @blueprintjs/icons@5.1.7
  • Browser and OS versions: Chromium: 115.0.5790.171 (arm64), macOS 13.6

Question

I'm using @blueprintjs/icons in a Vite project (yarn create vite repro-app --template react-swc-ts) following the static imports method, e.g.:

import { Person } from '@blueprintjs/icons';

// ...

<Person size={12} />

When I throttle network speed and record performance in Chrome, I notice that blueprint-icons.ttf is the last resource requested over the network, delaying the Load event a little while longer:

Screenshot 2023-09-21 at 10 15 43 PM

As far as I can tell, icons are already being rendered as SVGs before this request is even made, and I'm not certain if this file ever gets used.

Could anyone help me understand – what is the purpose of this file? Is it possible to configure @blueprintjs/icons to prevent the file from being requested? Thanks!

@adidahiya
Copy link
Contributor

Is it possible to configure @blueprintjs/icons to prevent the file from being requested?

Yes, it should be possible to avoid the font imports by omitting blueprint-icons.css from your bundle. You will notice that this file only imports font files, so if you are not using any of the icon font APIs, you can remove any import of it:

- import "@blueprintjs/icons/lib/css/blueprint-icons.css";

See: https://unpkg.com/browse/@blueprintjs/icons@5.1.7/lib/css/blueprint-icons.css

@bitjson
Copy link
Author

bitjson commented Sep 27, 2023

Ah, great, thanks for the confirmation!

@bitjson bitjson closed this as completed Sep 27, 2023
pvcnt added a commit to pvcnt/mergeable that referenced this issue Aug 31, 2024
Cf. palantir/blueprint#6401
This import is not useful if not using the icon fonts, while adding
significant size to the bundle.
pvcnt added a commit to pvcnt/mergeable that referenced this issue Aug 31, 2024
Cf. palantir/blueprint#6401 This import is not
useful if not using the icon fonts, while adding significant size to the
bundle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants