# node-px2rem

> Pixel to rem postproccessor

Latest version **2.0.5** (published 2021-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-px2rem
pnpm add node-px2rem
yarn add node-px2rem
bun add node-px2rem
```

## 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 | 2.0.5 |
| Published | 2021-01-02 |
| First published | 2014-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 2 |
| Unpacked size | 28 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 27 |
| Author | Gergely Kovács |
| Maintainers | ggkovacs |
| Keywords | css, parser, postproccessor, rem, responsive |

## Links

- npm: https://www.npmjs.com/package/node-px2rem
- Repository: https://github.com/ggkovacs/node-px2rem
- Issues: https://github.com/ggkovacs/node-px2rem/issues
- npm.io page: https://npm.io/package/node-px2rem

## Dependencies (2)

- [extend](https://npm.io/package/extend.md) ^3.0.2
- [postcss](https://npm.io/package/postcss.md) ^8.2.2

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.0.5 (latest) — 2021-01-02
- 2.0.4 — 2020-05-27
- 2.0.3 — 2020-01-02
- 2.0.2 — 2019-07-25
- 2.0.1 — 2019-06-22
- 2.0.0 — 2019-01-22
- 1.1.7 — 2018-07-28
- 1.1.6 — 2018-03-15
- 1.1.5 — 2017-05-14
- 1.1.4 — 2016-07-13
- 1.1.3 — 2016-05-01
- 1.1.2 — 2016-04-03
- 1.1.1 — 2016-02-25
- 1.1.0 — 2016-01-26
- 1.0.8 — 2015-12-25
- … 8 more at https://npm.io/package/node-px2rem/versions

## README

# Pixel to rem [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coverage-image]][coverage-url]
Version: **2.0.5**

## Installation

Run `npm install node-px2rem`

## Usage

```js
'use strict';

const fs = require('fs');
const px2rem = require('node-px2rem');
const css = fs.readFileSync('main.css', 'utf8');
const processedCSS = px2rem.process(css, {
  rootValue: 16
});

fs.writeFile('main-rem.css', processedCSS, (err) => {
  if (err) {
    throw err;
  }

  console.log('Done.');
});
```

## API

### Options

Type: `Object | Null`
Default:
```js
{
  rootValue: 16,
  unitPrecision: 5,
  propertyBlackList: [],
  propertyWhiteList: [],
  replace: false,
  mediaQuery: false,
  minPx: 1
}
```

- `rootValue` (Number) The root element font size.
- `unitPrecision` (Number) The decimal numbers to allow the REM units to grow to.
- `propertyBlackList` (Array) The properties that can't change from px to rem.
- `propertyWhiteList` (Array) The properties that can change from px to rem
- `replace` (Boolean) Replaces rules containing rems instead of adding fallbacks.
- `mediaQuery` (Boolean) Allow px to be converted in media queries.
- `minPx` (Number) If minimum px greater than or equal can change from px to rem.

# License
MIT © 2021 Gergely Kovács (gg.kovacs@gmail.com)

[npm-image]: https://badge.fury.io/js/node-px2rem.svg
[npm-url]: https://npmjs.org/package/node-px2rem
[travis-image]: https://travis-ci.com/ggkovacs/node-px2rem.svg?branch=master
[travis-url]: https://travis-ci.com/ggkovacs/node-px2rem
[daviddm-image]: https://david-dm.org/ggkovacs/node-px2rem.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/ggkovacs/node-px2rem
[coverage-image]: https://coveralls.io/repos/ggkovacs/node-px2rem/badge.svg?service=github&branch=master
[coverage-url]: https://coveralls.io/github/ggkovacs/node-px2rem?branch=master

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