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.1387,926latest
5.0.0-rc.2201next
4.0.0-nightly.2020.2.619nightly

Version History

VersionDownloads (Last 7 Days)Published
7.0.1387,926
7.0.01,347,292
6.1.01,771,453
6.0.321,312
6.0.217,742
6.0.1131,296
6.0.0296,967
5.1.05,004,424
5.0.428,888
5.0.344,754
5.0.246,242
5.0.1215,535
5.0.014,428
5.0.0-rc.2201
5.0.0-rc.13
5.0.0-rc.01
4.0.0-nightly.2020.2.619
4.0.0-nightly.2020.1.110
4.0.0-nightly.2020.1.91
4.0.0-nightly.2020.10.202
4.0.0-nightly.2020.9.9111
4.0.0-nightly.2020.9.31
4.0.0-nightly.2020.9.10
4.0.0-nightly.2020.8.291
4.0.0-nightly.2020.8.252
4.0.0-nightly.2020.8.240
4.0.0-nightly.2020.8.170
4.0.0-nightly.2020.8.101
4.0.0-nightly.2020.8.42
4.0.0-nightly.2020.8.10
4.0.0-nightly.2020.7.310
4.0.0-nightly.2020.7.251
4.0.0-nightly.2020.7.240
4.0.22,250,628
4.0.167
4.0.01,844
4.0.0-rc.225
4.0.0-rc.02
1.0.5383,925
1.0.47
1.0.312
1.0.244
1.0.11
1.0.02

Package Sidebar

Install

npm i postcss-minify-font-values

Weekly Downloads

11,965,162

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