Integrate postcss plugin pxtorem and pxtovw in vite
# pnpm
pnpm add -D vite-plugin-px-rem-vw
# yarn
yarn add -D vite-plugin-px-rem-vw
# npm
npm i -D vite-plugin-px-rem-vw
// vite.config.js
import { defineConfig } from 'vite'
import pxToRemOrVwPlugin from "vite-plugin-px-rem-vw"
export default defineConfig({
plugins: [
pxToRemOrVwPlugin({
type: 'rem',
options: {
rootValue: 20
}
}),
],
})
//pxtovw
interface Vw {
type: 'vw';
options?: VwConfig;
}
//pxtorem
interface Rem {
type: 'rem';
options?: RemConfig;
}
type Options = Vw | Rem;