# postcss-font-weights

> Use common font weights in CSS

Latest version **5.0.0** (published 2018-10-09) · CC0-1.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install postcss-font-weights
pnpm add postcss-font-weights
yarn add postcss-font-weights
bun add postcss-font-weights
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2018-10-09 |
| First published | 2015-06-23 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 1 |
| Unpacked size | 23.6 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Jonathan Neal |
| Maintainers | jonathantneal, trysound |
| Keywords | postcss, css, postcss-plugin, fonts, weights, font-weight, common, names, numerics, shorthands, values |

## Links

- npm: https://www.npmjs.com/package/postcss-font-weights
- Repository: https://github.com/jonathantneal/postcss-font-weights
- Homepage: https://github.com/jonathantneal/postcss-font-weights#readme
- Issues: https://github.com/jonathantneal/postcss-font-weights/issues
- npm.io page: https://npm.io/package/postcss-font-weights

## Dependencies (1)

- [postcss](https://npm.io/package/postcss.md) ^7.0.5

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2018-10-09
- 4.0.0 — 2017-05-25
- 3.0.1 — 2016-12-14
- 3.0.0 — 2016-12-06
- 2.0.1 — 2015-12-08
- 2.0.0 — 2015-08-31
- 1.0.1 — 2015-08-03
- 1.0.0 — 2015-08-03
- 0.1.2 — 2015-06-23
- 0.1.1 — 2015-06-23
- 0.1.0 — 2015-06-23

## README

# PostCSS Font Weights [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss]

[![NPM Version][npm-img]][npm-url]
[![Build Status][cli-img]][cli-url]
[![Support Chat][git-img]][git-url]

[PostCSS Font Weights] lets you do this in CSS.

```pcss
h1, h2, h3 {
  font-weight: light;
}

pre {
   font: light 100% monospace;
}

/* becomes */

h1, h2, h3 {
  font-weight: 300;
}

pre {
   font: 300 100% monospace;
}
```

Common font weights are found in the Font Weight Numeric Values section of the
[CSS Fonts Specification].

| Common Weight | Numeric Value |
| ------------- | ------------- |
| thin          | 100           |
| extralight    | 200           |
| ultralight    | 200           |
| light         | 300           |
| book          | 400           |
| normal        | 400           |
| regular       | 400           |
| roman         | 400           |
| medium        | 500           |
| semibold      | 600           |
| demibold      | 600           |
| bold          | 700           |
| extrabold     | 800           |
| ultrabold     | 800           |
| black         | 900           |
| heavy         | 900           |

These common font weights are converted to their numeric counterpart.

## Usage

Add [PostCSS Font Weights] to your project:

```bash
npm install postcss-font-weights --save-dev
```

Use [PostCSS Font Weights] to process your CSS:

```js
const postcssFontWeights = require('postcss-font-weights');

postcssFontWeights.process(YOUR_CSS /*, processOptions, pluginOptions */);
```

Or use it as a [PostCSS] plugin:

```js
const postcss = require('postcss');
const postcssFontWeights = require('postcss-font-weights');

postcss([
  postcssFontWeights(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```

[PostCSS Font Weights] runs in all Node environments, with special instructions for:

| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |

## Options

#### prefix

The `prefix` option determines the prefix applied to properties being processed
(e.g. `x` for `-x-font-weight`). Wrapping dashes (`-`) are automatically
applied.

### custom

The `custom` option determines additional font weight keywords and numeric
pairs (e.g. `custom: { lite: 300 }` for `font-weight: lite` to become
`font-weight: 300`).

[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-font-weights.svg
[cli-url]: https://travis-ci.org/jonathantneal/postcss-font-weights
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
[git-url]: https://gitter.im/postcss/postcss
[npm-img]: https://img.shields.io/npm/v/postcss-font-weights.svg
[npm-url]: https://www.npmjs.com/package/postcss-font-weights

[CSS Fonts Specification]: https://www.w3.org/TR/css-fonts-3/#font-weight-numeric-values
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Font Weights]: https://github.com/jonathantneal/postcss-font-weights

---
_Source: https://npm.io/package/postcss-font-weights · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
