antfu / purge-icons

🎐 Bundles icons on demand
https://www.npmjs.com/package/purge-icons
MIT License
229 stars 18 forks source link

Some icons are not recognized #25

Closed FairyEver closed 2 years ago

FairyEver commented 2 years ago

Thank you for making such a good tool, but I found a little problem:

on node_ modules/@purge-icons/core/dist/index. The length of CollectionIds variable is 93

var CollectionIds = ["mdi", "mdi-light", "ic", "uil", "uim", "ph", "bx", "ri", "la", "jam", "ion", "bi", "clarity", "carbon", "cil", "gg", "tabler", "teenyicons", "fa-solid", "fa-regular", "vaadin", "icomoon-free", "eva", "pixelarticons", "majesticons", "dashicons", "entypo", "zondicons", "flat-color-icons", "octicon", "codicon", "ant-design", "feather", "fe", "radix-icons", "line-md", "system-uicons", "akar-icons", "gridicons", "heroicons-outline", "heroicons-solid", "file-icons", "mi", "ps", "el", "foundation", "typcn", "subway", "raphael", "icons8", "wpf", "iwwa", "topcoat", "ei", "bytesize", "fluent", "grommet-icons", "maki", "oi", "et", "vscode-icons", "fa", "zmdi", "whh", "si-glyph", "ls", "simple-line-icons", "flat-ui", "vs", "websymbol", "il", "bpmn", "fontelico", "noto", "noto-v1", "twemoji", "openmoji", "emojione", "emojione-monotone", "emojione-v1", "fxemoji", "logos", "cib", "simple-icons", "fa-brands", "brandico", "entypo-social", "cryptocurrency", "map", "geo", "cif", "wi", "medical-icon"]

but in https://icones.netlify.app/collection/all You can see "all 112 icons" on the page. Are some icon libraries missing in the code?

For example, I'm trying to use it icon-park-outline Purge icons cannot find and package the icon

eg:

test.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <span class="iconify" data-icon="fa:home"></span>
  <span class="iconify" data-icon="icon-park-outline:home"></span>
</body>
</html>

run

const { PurgeIcons } = require('@purge-icons/core');
const { writeFile } = require('fs/promises');

(async () => {
  const code = await PurgeIcons({
    content: [
      'test.html'
    ],
    format: 'json'
  })
  writeFile('./purge-icons.json', code, 'utf-8')
})()

get

[
  {
    "prefix": "fa",
    "width": 1536,
    "height": 1536,
    "icons": {
      "home": {
        "body": "<path fill=\"currentColor\" d=\"M1408 768v480q0 26-19 45t-45 19H960V928H704v384H320q-26 0-45-19t-19-45V768q0-1 .5-3t.5-3l575-474l575 474q1 2 1 6zm223-69l-62 74q-8 9-21 11h-3q-13 0-21-7L832 200L140 777q-12 8-24 7q-13-2-21-11l-62-74q-8-10-7-23.5T37 654L756 55q32-26 76-26t76 26l244 204V64q0-14 9-23t23-9h192q14 0 23 9t9 23v408l219 182q10 8 11 21.5t-7 23.5z\"/>",
        "width": 1664,
        "height": 1312
      }
    }
  }
]

In the final result, there is only fa:home and no icon-park-outline:home

antfu commented 2 years ago

PR welcome