jaywcjlove / svgtofont

Read a set of SVG icons and ouput a TTF/EOT/WOFF/WOFF2/SVG font.
https://jaywcjlove.github.io/svgtofont
MIT License
575 stars 87 forks source link

Limit output to only woff2? #238

Open zoaha opened 3 months ago

zoaha commented 3 months ago

Is it possible to limit the font outputs to ONLY woff2?

This works for only generating the .css instead of .less, .sass, ....:

    css: {
        output: "output",
        include: "\\.(css)$"
    }

Is there something similar for the font files? I only need woff2.

Ideally generating:

@font-face {
  font-family: "myIcons";
  src: url("myIcons.woff") format("woff2")
}
jaywcjlove commented 1 week ago

@zoaha It may require a tool to remove it.

npm install --global del-cli
$ del --help

  Usage
    $ del <path|glob> …

  Options
    --force, -f    Allow deleting the current working directory and outside
    --dry-run, -d  List what would be deleted instead of deleting
    --verbose, -v  Display the absolute path of files and directories as they are deleted

  Examples
    $ del unicorn.png rainbow.png
    $ del "*.png" "!unicorn.png"
amirrezamini commented 1 week ago

@jaywcjlove I think it would be idead to add this option to the configuration instead of using another tool.

"excludeFormat": [
  "eot",
  "svg",
  "symbol.svg",
  "ttf",
  "woff"
]

@zoaha You can use node:fs unlink for now...

jaywcjlove commented 1 week ago

https://github.com/jaywcjlove/svgtofont/blob/9eeeb3c0ee0f5fe97e2860b4c5270e1664fe0f55/src/index.ts#L133-L137

I have added this setting and updated it to v6.1.0. @amirrezamini