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

Duplicate CSS declarations #167

Closed
KazariEX opened this issue May 29, 2024 · 2 comments
Closed

Duplicate CSS declarations #167

KazariEX opened this issue May 29, 2024 · 2 comments

Comments

@KazariEX
Copy link

KazariEX commented May 29, 2024

Could the default CSS declarations be extracted into the .iconify rule?

image

Copy link
Member

atinux commented May 29, 2024

cc @antfu

@KazariEX KazariEX changed the title Duplicate CSS rules Duplicate CSS declarations May 29, 2024
@antfu
Copy link
Member

antfu commented May 30, 2024

Currently, this is how Iconify generates those data. I don't consider this a very big issue as gzip should do the work already.

Also mention some of the trade-off if we going to do so:

  1. Properties like width and height can be different for different icons.
  2. Rendering mode can be different for different icons (here, use mask for most monochrome icons), but there are also colored icons where we need to use a background image (read https://antfu.me/posts/icons-in-pure-css)
  3. .iconify is too general to be a common class, as it is also shared with SVG mode. We might introduce a .iconify-css and put the common props there. Which we also add that class name to every icon.

So, in the end, it might still be useful to have such optimization, but I would expect somewhat around ~10% size improvements after gzip - if that still matters to you, PR is greatly welcome :)

@antfu antfu closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2024
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

3 participants