https://github.com/7studio/postcss-minify-font-values
Minify font declarations with PostCSS
https://github.com/7studio/postcss-minify-font-values
Last synced: 4 months ago
JSON representation
Minify font declarations with PostCSS
- Host: GitHub
- URL: https://github.com/7studio/postcss-minify-font-values
- Owner: 7studio
- License: mit
- Created: 2015-10-30T10:48:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-08T07:48:59.000Z (over 10 years ago)
- Last Synced: 2024-12-31T03:42:56.939Z (over 1 year ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# postcss-minify-font-values [![Build Status][ci-img]][ci]
> 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](test).
```css
h1 {
font:bold 2.2rem/.9 "Open Sans Condensed", sans-serif;
}
p {
font-family: "Helvetica Neue", Arial, sans-serif, Helvetica;
font-weight: normal;
}
```
```css
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: `true`
Pass `false` to disable the module from removing font families after it
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`
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][mathias].
## Usage
```js
postcss([ require('postcss-minify-font-values') ])
```
See [PostCSS] docs for examples for your environment.
MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)
[mathias]: https://mathiasbynens.be/notes/unquoted-font-family
[PostCSS]: https://github.com/postcss/postcss
[ci-img]: https://travis-ci.org/TrySound/postcss-minify-font-values.svg
[ci]: https://travis-ci.org/TrySound/postcss-minify-font-values