Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

postcss-pxtorem如何只转换mand-mobile组件的px #103

@u14e

Description

@u14e
  • Mand Mobile Version: 1.7.0

因为项目之前用了rem和px混合编写,目前按需加载mend-mobile组件,会打乱之前的size。希望postcss-pxtorem只转换mend-mobile组件里面的样式,看postcss-pxtorem官网貌似没有忽略文件的功能

cuth/postcss-pxtorem#39

  • 我的配置文件
  • .babelrc
{
  "plugins": [
    ["import",
      {
        "libraryName": "mand-mobile",
        "libraryDirectory": "lib"
      }
    ]
  ]
}
  • .postcssrc.js
module.exports = {
  "plugins": {
    "postcss-import": {},
    "postcss-url": {},
    // to edit target browsers: use "browserslist" field in package.json
    "autoprefixer": {},
    "postcss-pxtorem": {
      rootValue: 100,
      propWhiteList: ['*'],
      selectorBlackList: [/^html$/]
    }
  }
}

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions