0.0.8 • Published 2 years ago

unocss-unit-to-vw v0.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

unocss-unit-to-vw

Convert all rem/px to vw in utils

Install

npm install --save-dev unocss-unit-to-vw

Usage

Options

// rem to vw options
interface RemToVwOptions {
	baseFontSize?: number // defalut 16
	baseWidth?: number // defalut 375
	unitPrecision?: number // defalut 4
}

Config

import { defineConfig } from 'vite'
import UnoCSS from 'unocss/vite'
import { presetUno } from 'unocss'
import presetRemToVw from "unocss-unit-to-vw"

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    UnoCSS({
      presets: [
        presetUno(),
        presetRemToVw()
      ],
    }),
  ],
})

without

.m-2 {
  margin: 0.5rem;
}

.m-8px {
  margin: 8px;
}

with

.m-2 {
  margin: 2.1333vw;
}

.m-8px {
  margin: 2.1333vw;
}
0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago