1.0.1 • Published 1 year ago

unocss-preset-px-to-vw v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

unocss-preset-px-to-vw

A preset like postcss-px-to-viewport / 像postcss-px-to-viewport一样将px转成vw

Installation

npm i -D unocss-preset-px-to-vw

PxToVwOptions

export interface PxToVwOptions {
    /**
     * screen width / 设计稿宽度
     * @default 750
     */
    viewportWidth?: number;
}

Config

import presetUno from '@unocss/preset-uno'
import presetPxToVw from 'unocss-preset-px-to-vw'

Unocss({
  presets: [
    presetUno(),
    presetPxToVw(/* PxToVwOptions */ )
  ],
})

Usage

<div class="m-750px"></div>

without

.m-2 {
  margin: 750px;
}

with

.m-2 {
  margin: 100vw;
}

TODO

Improve the configurable properties,such as propList viewportUnit etc.

License

MIT License © 2022-PRESENT Wyatex

1.0.1

1 year ago

1.0.0

1 year ago