# unplugin-px-to-rem

> transform px to rem

Latest version **0.1.5** (published 2023-03-06) · MIT license · 3 weekly downloads

## Install

```sh
npm install unplugin-px-to-rem
pnpm add unplugin-px-to-rem
yarn add unplugin-px-to-rem
bun add unplugin-px-to-rem
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score; declining downloads.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2023-03-06 |
| First published | 2023-03-05 |
| Weekly downloads | 3 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | legend0610 |
| Keywords | unplugin, vite, webpack, rollup, transform, px to rem, rem |

## Links

- npm: https://www.npmjs.com/package/unplugin-px-to-rem
- Repository: https://github.com/legend402/unplugin-px-to-rem
- Homepage: https://github.com/legend402/unplugin-px-to-rem#readme
- Issues: https://github.com/legend402/unplugin-px-to-rem/issues
- npm.io page: https://npm.io/package/unplugin-px-to-rem

## Dependencies (2)

- [unplugin](https://npm.io/package/unplugin.md) ^1.0.1
- [unplugin-px-to-rem](https://npm.io/package/unplugin-px-to-rem.md) workspace:^0.1.2

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.1.5 (latest) — 2023-03-06
- 0.1.4 — 2023-03-06
- 0.1.3 — 2023-03-06
- 0.1.2 — 2023-03-06
- 0.1.1 — 2023-03-05
- 0.1.0 — 2023-03-05

## README

# [unplugin-px-to-rem](https://github.com/legend402/unplugin-px-to-rem)

[![NPM version](https://www.npmjs.com/package/unplugin-px-to-rem?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-px-to-rem)

transform px to rem, you can specify the directory you want to convert to

## Usage

| options  | desc                           | type     | default |
| -------- | ------------------------------ | -------- | ------- |
| endWith  | files type                     | string[] | []      |
| exclude  | directory that is not included | string[] | []      |
| dirs     | directory that is included    | string[] | []      |
| fontBase | conversion ratio               | number   | 16      |

## Install

```bash
npm i unplugin-px-to-rem -D
```

<details>
<summary>Vite</summary><br>

```ts
// vite.config.ts
import UnpluginPxToRem from 'unplugin-px-to-rem/vite'

export default defineConfig({
  plugins: [
    UnpluginPxToRem ({ /* options */ }),
  ],
})
```

Example: [`playground/`](./playground/)

<br></details>

<details>
<summary>Rollup</summary><br>

```ts
// rollup.config.js
import UnpluginPxToRem  'unplugin-px-to-rem/rollup'

export default {
  plugins: [
    UnpluginPxToRem ({ /* options */ }),
  ],
}
```

<br></details>

<details>
<summary>Webpack</summary><br>

```ts
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-px-to-rem/webpack')({ /* options */ })
  ]
}
```

<br></details>

<details>
<summary>Nuxt</summary><br>

```ts
// nuxt.config.js
export default {
  buildModules: [
    ['unplugin-px-to-rem/nuxt', { /* options */ }],
  ],
}
```

> This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)

<br></details>

<details>
<summary>Vue CLI</summary><br>

```ts
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-px-to-rem/webpack')({ /* options */ }),
    ],
  },
}
```

Example: [`playground2/`](./playground2/)

<br></details>

<details>
<summary>esbuild</summary><br>

```ts
// esbuild.config.js
import { build } from 'esbuild'
import UnpluginPxToRem from 'unplugin-px-to-rem/esbuild'

build({
  plugins: [UnpluginPxToRem ()],
})
```

<br></details>

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