icon icon indicating copy to clipboard operation
icon copied to clipboard

Duplicate CSS declarations

Open KazariEX opened this issue 1 year ago • 2 comments

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

image

KazariEX avatar May 29 '24 09:05 KazariEX

cc @antfu

atinux avatar May 29 '24 15:05 atinux

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 avatar May 30 '24 11:05 antfu