README
PostCSS Font Variation Plugin
PostCSS Font Variation Plugin adds font-variation-settings
based on font-stretch
, font-style
, font-weight
and font
properties.
Source | Transpiled |
---|---|
|
|
Plugin uses CSS variables, which allows combining settings from multiple matching rules. E.g.:
Source | Transpiled |
---|---|
|
|
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')
]
}