1.0.0-alpha • Published 4 years ago

postcss-plugin-font-variation v1.0.0-alpha

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

PostCSS Font Variation Plugin

Test workflow status

PostCSS Font Variation Plugin adds font-variation-settings based on font-stretch, font-style, font-weight and font properties.

Plugin uses CSS variables, which allows combining settings from multiple matching rules. E.g.:

This way element with class="foo bar" will have font-variation-settings set to 'ital' 1, 'wdth' 100, 'wght' 400, not just 'wght' 400.

Usage

Step 1: Install plugin:

npm install --save-dev postcss postcss-plugin-font-variation

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-plugin-font-variation'),
    require('autoprefixer')
  ]
}