# postcss-math

> PostCSS plugin for making calculations with math.js

Latest version **0.0.10** (published 2018-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-math
pnpm add postcss-math
yarn add postcss-math
bun add postcss-math
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2018-01-02 |
| First published | 2015-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 33 |
| Author | Shaun Stanworth |
| Maintainers | shauns |
| Keywords | postcss, css, postcss-plugin, math.js, math |

## Links

- npm: https://www.npmjs.com/package/postcss-math
- Repository: https://github.com/shauns/postcss-math
- Issues: https://github.com/shauns/postcss-math/issues
- npm.io page: https://npm.io/package/postcss-math

## Dependencies (4)

- [mathjs](https://npm.io/package/mathjs.md) ^3.17.0
- [postcss](https://npm.io/package/postcss.md) ^5.0.19
- [reduce-function-call](https://npm.io/package/reduce-function-call.md) ^1.0.1
- [postcss-message-helpers](https://npm.io/package/postcss-message-helpers.md) ^2.0.0

## 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

- 0.0.10 (latest) — 2018-01-02
- 0.0.9 — 2018-01-02
- 0.0.8 — 2017-03-31
- 0.0.7 — 2017-01-26
- 0.0.6 — 2017-01-26
- 0.0.5 — 2016-08-09
- 0.0.4 — 2016-08-08
- 0.0.1 — 2015-07-23

## README

# PostCSS Math [![Build Status][ci-img]][ci]

## Work-in-progress!

[PostCSS] plugin for making calculations with math.js.

[PostCSS]: https://github.com/postcss/postcss
[ci-img]:  https://travis-ci.org/shauns/postcss-math.svg
[ci]:      https://travis-ci.org/shauns/postcss-math


This plug-in supports:

* Plain-old maths, as per math.js built-in functionality
* `px`, `em`, `rem`, `vh`, `vmax` and other units
* CSS-friendly rendering (`10cm` not `10 cm`)
* Unit stripping e.g. `strip(25px)` becomes `25`
* Unit math operations e.g. `floor(12.6px)` becomes `12px` and `ceil(12.6px)` becomes `13px`

Contributions are very welcome!


```css
.foo {
    font-size: resolve(2 * 8px);
    padding: resolve(strip(16cm) + (2px * 3));
    margin: resolve(4px + resolve(2 * 3px));
}
```

```css
.foo {
    font-size: 16px;
    padding: 22px;
    margin: 10px;
}
```

## Usage

```js
postcss([ require('postcss-math') ])
```

See [PostCSS] docs for examples for your environment.

## Using `postcss-assets`?

You can pass in a `functionName` option to switch to something other than `resolve`.

## How does this differ to `postcss-calc`?

They're (deliberately) trying to work towards the calc(...) standard, so for 
instance it doesn't support things like exponentials at the moment. This wraps 
up math.js so you have a wider range of things you can do.

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