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

how to use it in rollup , with antd / antd-mobile integrated ? #78

Open
Kilims opened this issue Sep 17, 2021 · 2 comments
Open

how to use it in rollup , with antd / antd-mobile integrated ? #78

Kilims opened this issue Sep 17, 2021 · 2 comments

Comments

@Kilims
Copy link

Kilims commented Sep 17, 2021

by using this plugin , with webpack + antd/antd-mobile, my webpack.config.js will be :

require("postcss-pxtorem")({ rootValue: 37.5, propList: ["*"], minPixelValue: 2, selectorBlackList: [] }),

which works well

by how to use this plugin by using rollup ?

@mehimanshupatil
Copy link

I use like bellow in rollup.config.js

var pxtorem = require("postcss-pxtorem"); 
import postcss from "rollup-plugin-postcss";

export default {
    input: "src/index.ts",
    output: {
        dir: "build",
        format: "es",
        sourcemap: true,
        preserveModules: true,
        preserveModulesRoot: "src",
    },
    plugins: [
        postcss({
            minimize: true,
            plugins: [
                pxtorem({
                    rootValue: 16,
                    unitPrecision: 6,
                    propList: ["*"],
                }),
            ]
        })
    ]
};

@wmo123
Copy link

wmo123 commented Feb 15, 2023

I have met the same issue,My project has two sets of UIs, one is vant and another is element-plus,i want to make pxto rem in vant , then i try to set selectorBlackList: [ '.el-'] and don‘t set html fontsize to making px to rem invalid, However, this method does not work for CSS variables,So I put up an issue and I hope someone can help me answer it。

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

No branches or pull requests

3 participants