postcss-minify-font-values
TypeScript icon, indicating that this package has built-in type declarations

7.0.1 • Public • Published

postcss-minify-font-values Build Status

Minify font declarations with PostCSS.

This module will try to minimise the font-family, font-weight and font shorthand properties; it can unquote font families where necessary, detect & remove duplicates, and cut short a declaration after it finds a keyword. For more examples, see the tests.

h1 {
  font:bold 2.2rem/.9 "Open Sans Condensed", sans-serif;
}

p {
  font-family: "Helvetica Neue", Arial, sans-serif, Helvetica;
  font-weight: normal;
}
h1 {
  font:700 2.2rem/.9 Open Sans Condensed,sans-serif
}

p {
  font-family: Helvetica Neue,Arial,sans-serif;
  font-weight: 400;
}

API

minifyFontValues([options])

options

removeAfterKeyword

Type: boolean Default: false

Pass true to remove font families after the module encounters a font keyword, for example sans-serif.

removeDuplicates

Type: boolean Default: true

Pass false to disable the module from removing duplicated font families.

removeQuotes

Type: boolean | (prop: string) => '' | 'font' | 'font-family' | 'font-weight' Default: true

Pass false to disable the module from removing quotes from font families. Note that oftentimes, this is a safe optimisation & is done safely. For more details, see Mathias Bynens' article.

Pass a function to determine whether a css variable is one of font, font-family, and font-weight to determine whether the variable needs to remove quotes.

Usage

postcss([ require('postcss-minify-font-values') ])

See PostCSS docs for examples for your environment.

Contributors

See CONTRIBUTORS.md.

License

MIT © Bogdan Chadkin

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
7.0.1724,265latest
5.0.0-rc.2236next
4.0.0-nightly.2020.2.63nightly

Version History

VersionDownloads (Last 7 Days)Published
7.0.1724,265
7.0.01,112,112
6.1.01,861,987
6.0.321,715
6.0.217,539
6.0.1135,908
6.0.0293,794
5.1.05,418,837
5.0.437,394
5.0.335,080
5.0.245,303
5.0.1265,710
5.0.020,346
5.0.0-rc.2236
5.0.0-rc.10
5.0.0-rc.02
4.0.0-nightly.2020.2.63
4.0.0-nightly.2020.1.110
4.0.0-nightly.2020.1.90
4.0.0-nightly.2020.10.200
4.0.0-nightly.2020.9.90
4.0.0-nightly.2020.9.30
4.0.0-nightly.2020.9.10
4.0.0-nightly.2020.8.290
4.0.0-nightly.2020.8.250
4.0.0-nightly.2020.8.240
4.0.0-nightly.2020.8.171
4.0.0-nightly.2020.8.100
4.0.0-nightly.2020.8.40
4.0.0-nightly.2020.8.10
4.0.0-nightly.2020.7.310
4.0.0-nightly.2020.7.250
4.0.0-nightly.2020.7.240
4.0.22,540,549
4.0.166
4.0.03,679
4.0.0-rc.233
4.0.0-rc.01
1.0.5397,370
1.0.415
1.0.31
1.0.21
1.0.12
1.0.00

Package Sidebar

Install

npm i postcss-minify-font-values

Weekly Downloads

12,931,949

Version

7.0.1

License

MIT

Unpacked Size

18.6 kB

Total Files

18

Last publish

Collaborators

  • beneb
  • trysound
  • ludovicofischer
  • ai
  • chriseppstein
  • andyjansson
  • evilebottnawi
  • cssnano-bot