1.1.1 • Published 6 months ago
postcss-remove-font-face v1.1.1
postcss-remove-font-face
Remove @font-face blocks to avoid downloading fonts and speed up your websites.
Installation
npm install --save-dev postcss-remove-font-face
Examples
PostCSS
Ignore all remote fonts:
// postcss.config.ts
import postcssRemoveFontFace from 'postcss-remove-font-face';
export default {
plugins: [postcssRemoveFontFace()],
};
Ignore all remote fonts, except for iconfont
:
// postcss.config.ts
import postcssRemoveFontFace from 'postcss-remove-font-face';
export default {
plugins: [
postcssRemoveFontFace({
fontFamilyWhiteList: ['iconfont'],
}),
],
};
Vite
// vite.config.ts
import postcssRemoveFontFace from 'postcss-remove-font-face';
export default defineConfig({
css: {
postcss: {
plugins: [postcssRemoveFontFace()],
},
},
});
Options
fontFamilyWhiteList
@font-face
that match the font-family
white list will not be removed.
This is usually useful for icon fonts, which may break the site if removed.