Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]unocss 产出的 css 也经过 postcss 处理 #1850

Open
XiaoXice opened this issue Feb 17, 2025 · 1 comment · May be fixed by #1851
Open

[Feature Request]unocss 产出的 css 也经过 postcss 处理 #1850

XiaoXice opened this issue Feb 17, 2025 · 1 comment · May be fixed by #1851

Comments

@XiaoXice
Copy link
Contributor

希望在使用 unocss 时产出的 css 也经过 postcss 处理

需求背景
目前项目中使用了 unocss,并且使用 rpx 作为单位,但是真机上设计认为尺寸过大,需要整体改为px作为基础单位,我便写了一个postcss-plugin将之前项目中用到的rpx统一转化成px,但是unocss样式无法转化,希望可以支持。

@XiaoXice XiaoXice linked a pull request Feb 17, 2025 that will close this issue
@xushicheng
Copy link

分享个我自己写 unocss 的方式,希望能帮到你,修改uno.config.js文件,改

  presets: [
    presetMpx({
      baseFontSize: 8
    }),
    presetIcons()
  ],

基础字体大小设置为 8rpx,然后写样式,直接写 w-344 h-80就是 344 像素和 80 像素了,按照你的需求,你把baseFontSize改成 750 就行了。

  <view
    class="w-344 h-80 rd-12 border-1 border-solid border-black/10 shadow flex items-center py-16 pl-20 pr-16"
  >
    <slot></slot>
    <view class="i-ri-arrow-right-s-line text-24 text-black/45 ml-auto"></view>
  </view>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants