# @flatjs/forge-plugin-postcss-pixel

> the flatjs plugin to convert pixel unit to rem/rpx

Latest version **1.7.2** (published 2023-05-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install @flatjs/forge-plugin-postcss-pixel
pnpm add @flatjs/forge-plugin-postcss-pixel
yarn add @flatjs/forge-plugin-postcss-pixel
bun add @flatjs/forge-plugin-postcss-pixel
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.7.2 |
| Published | 2023-05-29 |
| First published | 2021-04-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | tianyingchun |
| Maintainers | tianyingchun |
| Keywords | flatjs, forge, rollup, plugin, postcss, pixel, rem, rpx |

## Links

- npm: https://www.npmjs.com/package/@flatjs/forge-plugin-postcss-pixel
- npm.io page: https://npm.io/package/@flatjs/forge-plugin-postcss-pixel

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.7.2 (latest) — 2023-05-29
- 1.6.0 — 2023-04-21
- 1.5.0 — 2023-02-02
- 1.4.1 — 2022-09-07
- 1.4.0 — 2022-07-13
- 1.3.17 — 2022-05-25
- 1.3.14 — 2022-04-30
- 1.3.6 — 2022-03-16
- 1.3.5 — 2022-03-08
- 1.3.0 — 2022-02-06
- 1.2.100 — 2022-01-07
- 1.2.99 — 2021-12-18
- 1.2.98 — 2021-12-12
- 1.2.97 — 2021-11-18
- 1.2.96 — 2021-11-13
- … 14 more at https://npm.io/package/@flatjs/forge-plugin-postcss-pixel/versions

## README

# The flatjs plugin `@flatjs/forge-plugin-postcss-pixel`

# Features

A plugin for PostCSS that generates rpx/rem units from px/rpx units

# Installation

```shell
$ npm i --save @flatjs/forge-plugin-postcss-pixel
```

# Usage

# programing

```tsx
import postcss from 'postcss';
import { writeFile, readFileSync } from 'fs';
import { forgePluginPostcssPixel } from '@flatjs/forge-plugin-postcss-pixel';
const css = readFileSync('/path/to/test.css', 'utf8');
const options = {
  replace: false,
};
const processedCss = postcss(forgePluginPostcssPixel(options)).process(css).css;

writeFile('/path/to/test.rem.css', processedCss, err => {
  if (err) throw err;
  console.log('Rem file written.');
});
```

## Using with `@flatjs/forge`

Please see samples of @flatjs/forge-plugin-styling

# Defaults Configuration

```typescript
const defaultOpts: Required<PixelOptions> = {
  rootValue: { px: 100, rpx: 1 },
  outputUnit: 'rem',
  unitPrecision: 5,
  selectorBlackList: [],
  propWhiteList: [],
  propBlackList: [],
  replace: true,
  mediaQuery: false,
  minPixelValue: 0,
  ignoreIdentifier: '',
  exclude: null,
};

```

# Reference

- [postcss playground](https://sneakertack.github.io/postcss-playground/)

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