UNPKG

fontmin-spider

Version:

Analyze which fonts are used on the page and eliminate the ones that are not used to get a smaller font file

21 lines (20 loc) 1.24 kB
import { Toptions } from './types'; export { default as parse } from './parse'; /** * Crawl the fonts referenced by the specified .html file for compression. * matching the text used according to the css selector, compressing on demand * @param options * @param { string } options.basePath You can think of it as the root of the website * @param { string | string[] } options.source https://github.com/mrmlnc/fast-glob#patterns * @param { boolean } options.backup backup font (font.backup.ttf) (default: true) * @param { string | object } options.reserveText * Reserved text. For example, when using JavaScript to add text dynamically. * the fontmin-spider will not be able to parse the text and you will need to add the reserved text manually * @param { string[] } options.ignore Ignore html file. https://github.com/mrmlnc/fast-glob#ignore * @param { Function } options.filter Execute when all the used fonts are parsed * (the strings are not parsed, you can use the afterFilter method if you need to process the strings) * @param { Function } options.afterFilter After parsing is complete, execute */ export declare function spider(options: { [T in keyof Toptions]: Toptions[T]; }): Promise<unknown[]>;