JSPM

postcss-font-family-switch

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q18543F
  • License MIT

PostCSS plugin Switch font-family depend on font-size

Package Exports

  • postcss-font-family-switch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-font-family-switch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

PostCSS Font Family Switch

PostCSS plugin that append font-family when font-size value is larger than target value.

Input:

.foo {
  font-size: 12px;
}

.bar {
  font-size: 16px;
}

Output:

.foo {
  font-size: 12px;
}

.bar {
  font-size: 16px;
  font-family: YourLargeFontFamily;
}

Usage

Step 1: 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 2: Add the plugin to plugins list:

module.exports = {
  plugins: [
+   require('postcss-font-family-switch', { largeFamily: 'LargeFont' }),
    require('autoprefixer')
  ]
}