evrone / postcss-px-to-viewport

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units. The best choice to create a scalable interface on different displays by one design size.
https://evrone.com/postcss-px-viewport
MIT License
3.07k stars 405 forks source link

postcss-px-to-viewport: postcss.plugin was deprecated #123

Open dengyizhenfeng opened 2 years ago

dengyizhenfeng commented 2 years ago

I referenced postcss-px-to-viewport in the project created by vue-cli, and there will be a prompt when packaging

Building for production...postcss-px-to-viewport: postcss.plugin was deprecated. Migration guide: https://evilmartians.com/chronicles/postcss-8-plugin-migration

Chasen-Zhang commented 2 years ago

same question

Chasen-Zhang commented 2 years ago

@KODerFunk

neohan666 commented 2 years ago

+1

fyl0531 commented 2 years ago

same question

songzhonghuasongzhonghua commented 2 years ago

same question

ifer-itcast commented 2 years ago

yarn add react-scripts@4

darksc commented 2 years ago

+1

ifredom commented 2 years ago

+1,can't use in Vite

ifredom commented 2 years ago

+1,can't use in Vite

PiscineMolitorPatel commented 2 years ago

same,i used vite.

Jonny-china commented 2 years ago

I wrote a version that supports plugin8 based on this repository. here

Genuifx commented 2 years ago

you can use my plugin instead. repo Postcss 8 compat.

using the transform func and unit you can transform px to any unit

such as pxtoviewport

pxtorpx({
      unit: 'vw',
      transform: (x) => {
          // 750 / 100 = x / y
         // assume your design base on 750px
          return x * (100 / 750);
      },
 })
zy-xmz commented 2 years ago

I use Vue3+Vite,my solution is: first step: npm uninstall postcss second step: npm install postcss@6.0.0

Perfumere commented 2 years ago

改写了下 https://github.com/philuo/postcss-px2vw

CaiWenlie commented 2 years ago

改写了下 https://github.com/philuo/postcss-px2vw

should submit a pull request

chrisma2012 commented 4 weeks ago

Probably not the plugin's reason. My project is using vue3+vite+typescript+vant, and then I got an error configuring vant's style shrink, and then I got the same issue as you. But once I fixed the vant misconfiguration, postcss-px-to-viewport worked fine. It's likely that the UI library you're using is configured incorrectly.