@unocss-applet/preset-rpx-to-rem
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

@unocss-applet/preset-rpx-to-rem

Coverts rem to rpx for utils.

Instal

npm i @unocss-applet/preset-rpx-to-rem --save-dev # with npm
yarn add @unocss-applet/preset-rpx-to-rem -D # with yarn
pnpm add @unocss-applet/preset-rpx-to-rem -D # with pnpm

Usage

import { defineConfig } from 'unocss'

import presetRpxToRem from '@unocss-applet/preset-rpx-to-rem'

export default defineConfig({
  presets: [
    // ...
    presetRpxToRem({ baseFontSize: 16, screenWidth: 375 }),
  ],
})

Type Declarations

export interface RpxToRemOptions {
  /**
   * 1rem = n px
   * @default 16
   */
  baseFontSize?: number

  /**
   * screen width in px
   * @default 375
   */
  screenWidth?: number
}
<div class="p-32rpx"></div>

without

.p-32rpx {
  padding: 32rpx;
}

with

.p-32rpx {
  padding: 1rem;
}

License

MIT License © 2022-PRESENT Neil Lee

Package Sidebar

Install

npm i @unocss-applet/preset-rpx-to-rem

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

4.48 kB

Total Files

6

Last publish

Collaborators

  • zguolee