# stylus-type-utils

> Stylus typography functions and type conversion

Latest version **0.0.3** (published 2013-02-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install stylus-type-utils
pnpm add stylus-type-utils
yarn add stylus-type-utils
bun add stylus-type-utils
```

## 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.3 |
| Published | 2013-02-09 |
| First published | 2013-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 28 |
| Author | Blake Embrey |
| Maintainers | blakeembrey |
| Keywords | stylus, typeograhy, coercion, rem, em, px, pt, percent |

## Links

- npm: https://www.npmjs.com/package/stylus-type-utils
- Repository: https://github.com/blakeembrey/stylus-type-utils
- npm.io page: https://npm.io/package/stylus-type-utils

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2013-02-09
- 0.0.2 — 2013-02-09

## README

# Stylus Type Utils

Much needed Stylus typeography unit coersion and normalization. Provides several common unit conversion functions to convert between types effortlessly and in sync with the content font size.

## Installation

    $ npm install stylus-type-utils --save

## API

To use the `stylus-type-utils` library within your framework, use `@import` or use via the Stylus JS API.

    base-font-size = 100% // Change to adjust the conversion process
    support-for-ie = true // Set to `false` for no `px` output with `rem`

    px(unit, ignore-base-font-size)
    pt(unit, ignore-base-font-size)
    em(unit, ignore-base-font-size)
    rem(unit, ignore-base-font-size)
    percent(unit, ignore-base-font-size)

When using the functions, omitting a unit type will assume the function unit type. E.g. `px(16) -> px(16px)`.

The second parameter, `ignore-base-font-size`, allows the function to act as if the `base-font-size` was to set `100%`.

## Example Usage

    @import "type-utils"

    base-font-size = 75%

    px(16) // 12px
    px(16, true) // 16px
    px(16px) // 12px
    px(1.2em) // 14.4px
    em(16px) // 0.75em

    rem(16px) // 12px, 0.75rem

    support-for-ie = false // No more px + rem output when using rem function

    rem(16px) // 0.75rem
    rem(16px, true) // 1rem

    base-font-size = 100%

    rem(16px) // 1rem
   

## License

MIT

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