a1be7f95ff383f8eededca48d5dc2f8cffa101172c3d8c94179856f45cf8190c54244f19d5f072b065f09ab18ba0bccaab388283548b79bcab0693919d5344 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # postcss-minify-font-values [![Build Status][ci-img]][ci]
  2. > Minify font declarations with PostCSS.
  3. This module will try to minimise the `font-family`, `font-weight` and `font` shorthand
  4. properties; it can unquote font families where necessary, detect & remove
  5. duplicates, and cut short a declaration after it finds a keyword. For more
  6. examples, see the [tests](test).
  7. ```css
  8. h1 {
  9. font:bold 2.2rem/.9 "Open Sans Condensed", sans-serif;
  10. }
  11. p {
  12. font-family: "Helvetica Neue", Arial, sans-serif, Helvetica;
  13. font-weight: normal;
  14. }
  15. ```
  16. ```css
  17. h1 {
  18. font:700 2.2rem/.9 Open Sans Condensed,sans-serif
  19. }
  20. p {
  21. font-family: Helvetica Neue,Arial,sans-serif;
  22. font-weight: 400;
  23. }
  24. ```
  25. ## API
  26. ### minifyFontValues([options])
  27. #### options
  28. ##### removeAfterKeyword
  29. Type: `boolean`
  30. Default: `true`
  31. Pass `false` to disable the module from removing font families after it
  32. encounters a font keyword, for example `sans-serif`.
  33. ##### removeDuplicates
  34. Type: `boolean`
  35. Default: `true`
  36. Pass `false` to disable the module from removing duplicated font families.
  37. ##### removeQuotes
  38. Type: `boolean`
  39. Default: `true`
  40. Pass `false` to disable the module from removing quotes from font families.
  41. Note that oftentimes, this is a *safe optimisation* & is done safely. For more
  42. details, see [Mathias Bynens' article][mathias].
  43. ## Usage
  44. ```js
  45. postcss([ require('postcss-minify-font-values') ])
  46. ```
  47. See [PostCSS] docs for examples for your environment.
  48. MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)
  49. [mathias]: https://mathiasbynens.be/notes/unquoted-font-family
  50. [PostCSS]: https://github.com/postcss/postcss
  51. [ci-img]: https://travis-ci.org/TrySound/postcss-minify-font-values.svg
  52. [ci]: https://travis-ci.org/TrySound/postcss-minify-font-values