Skip to content

swissgrc/postcss-remove-font-face-format

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postcss-remove-font-face-format

PostCSS plugin to remove font faces by format.

.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");
  }
}
.foo {
  /* Output example */
  @font-face {
    font-family: "Open Sans";
    src: url("/fonts/OpenSans-Regular-webfont.woff") format("woff");
  }
}

Usage

Step 1: Install plugin:

npm install --save-dev postcss postcss-remove-font-face-format

Step 2: Check you project for existed PostCSS config: postcss.config.js in the project root, "postcss" section in package.json or postcss 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:

module.exports = {
  plugins: [
+   require('postcss-remove-font-face-format'),
    require('autoprefixer')
  ]
}