# rework-math

> math plugin for the Rework CSS preprocessing library

Latest version **1.0.1** (published 2013-08-16) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2013-08-16 |
| First published | 2013-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | James Doyle |
| Maintainers | james2doyle |
| Keywords | css, rework, mathematics, calc, calculation, math |

## Links

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

## Dependencies (1)

- [rework-visit](https://npm.io/package/rework-visit.md) *

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

- 1.0.1 (latest) — 2013-08-16
- 1.0.0 — 2013-06-22

## README

rework-math
=============

Do some math in your [Rework](https://github.com/visionmedia/rework) CSS files.

```css
div {
  padding: math(5+5px);
}
```

yields:

```css
div {
  padding: 10px;
}
```

### using [rework-vars](https://github.com/visionmedia/rework-vars)

```css
:root {
  var-fontSize: 10px;
}

div {
  padding: math((var(fontSize) * 2) + 10px);
}
```

yields:

```css
:root {
  var-fontSize: 10px;
}

div {
  padding: 30px;
}
```

Of course using rework-vars requires you to run the vars function first.

### Rendering the correct units

Just add the unit you want at the end of the function. Like so:

```css
.header {
  font-size: math(2 * 14px);
}
```

yields:

```css
.header {
  font-size: 28px;
}
```

### How about Percent?!

Ummm, not ready yet! Right now you will have to divide any number that needs to be a percent by 100. So in the following example you want to know what 33% of 100 is. You need to multiply 100 by 0.33%. We add the `%` so that we get the right unit at the end.

```css
.span33 {
  width: math(100 * 0.33333333%);
}
```

yields:

```css
.span33 {
  width: 33.333332999999996%;
}
```

# License

  MIT

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