PostCSS plugin to remove font faces by format
npm install postcss-remove-font-face-format[PostCSS] plugin to remove font faces by format.
[PostCSS]: https://github.com/postcss/postcss
``css`
.foo {
/ Input example /
@font-face {
font-family: "Open Sans";
src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
url("/fonts/OpenSans-Regular-webfont.woff") format("woff");
}
}
`css`
.foo {
/ Output example /
@font-face {
font-family: "Open Sans";
src: url("/fonts/OpenSans-Regular-webfont.woff") format("woff");
}
}
Step 1: Install plugin:
`sh`
npm install --save-dev postcss postcss-remove-font-face-format
Step 2: Check your project for existing PostCSS config: postcss.config.js"postcss"
in the project root, section in package.jsonpostcss
or in bundle config.
If you do not use PostCSS, add it according to [official docs]
and set this plugin in settings.
Step 3: Add the plugin to plugins list:
`diff``
module.exports = {
plugins: [
+ require('postcss-remove-font-face-format'),
require('autoprefixer')
]
}
[official docs]: https://github.com/postcss/postcss#usage