-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ef8d87
commit 8fe8185
Showing
7 changed files
with
198 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
declare module 'postcss-discard-font-face' { | ||
import { type Plugin as PostCssPlugin } from 'postcss'; | ||
|
||
/** | ||
* For each font, return `false` to remove, or a new string if you would like | ||
* to transform the *URL*. | ||
* | ||
* @example | ||
* ```typescript | ||
* (url: string, format: string) => { | ||
* return !url.includes('.exe'); // remove if url ends with `.exe` | ||
* } | ||
* ``` | ||
*/ | ||
type FilterFunction = (url: string, format: string) => boolean | string; | ||
|
||
/** | ||
* Allowlist is an array of formats to *keep*. | ||
* | ||
* @example | ||
* ```javascript | ||
* ['ttf', 'svg'] // keep ttf and svg formats | ||
* ``` | ||
*/ | ||
type Allowlist = string[]; | ||
|
||
/** | ||
* @example | ||
* ```javascript | ||
* { | ||
* weight: [400], | ||
* style: ['normal'] | ||
* } | ||
* ``` | ||
*/ | ||
type Properties = Record<string, unknown[]>; | ||
|
||
/** | ||
* @example | ||
* ```typescript | ||
* const options = { | ||
* font: { | ||
* // keep `Arial` with `weight: 400` and `style: normal` | ||
* Arial: { | ||
* weight: [400], | ||
* style: ["normal"] | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
type Options = { | ||
font: { | ||
[fontName: string]: Properties; | ||
}; | ||
}; | ||
|
||
/** | ||
* Discard font faces with PostCSS. | ||
* | ||
* @param filter - A filter function, allowlist, or options object | ||
*/ | ||
function discardFontFace( | ||
filter: Allowlist | FilterFunction | Options, | ||
): PostCssPlugin; | ||
|
||
export = discardFontFace; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters