Skip to content

Rem to px preset

모든 유틸리티의 rem을 px로 변환합니다.

소스 코드

설치

bash
pnpm add -D @unocss/preset-rem-to-px
bash
yarn add -D @unocss/preset-rem-to-px
bash
npm install -D @unocss/preset-rem-to-px
bash
bun add -D @unocss/preset-rem-to-px
ts
import presetRemToPx from '@unocss/preset-rem-to-px'
import { defineConfig } from 'unocss'

export default defineConfig({
  presets: [
    presetRemToPx(),
    // ...other presets
  ],
})

사용법

html
<div class="m-2"></div>
css
.m-2 {
  margin: 0.5rem;
}
css
.m-2 {
  margin: 8px;
}

옵션

baseFontSize

  • 타입: number
  • 기본값: 16

rem을 px로 변환할 기준 폰트 크기 (1rem = n px).

Released under the MIT License.