px调整倍数问题修复

This commit is contained in:
DESKTOP-VMMLSOQ\wangzg 2024-03-02 22:59:49 +08:00
parent cce1ddfa72
commit 1ed5af4681
3 changed files with 21 additions and 19 deletions

View File

@ -12,10 +12,11 @@ module.exports = postcss.plugin('postcss-px2rem', (option) => {
}, option) }, option)
return (root, result) => { return (root, result) => {
const file = root.source.input.file
const ignore = opt.ignore || [] const ignore = opt.ignore || []
const file = result.opts.from
for (const ignoreElement of ignore) { for (const ignoreElement of ignore) {
if (file.indexOf(ignoreElement) >= 0) return const regExp = new RegExp(ignoreElement)
if (regExp.test(file)) return
} }
root.walkDecls(function (decl) { root.walkDecls(function (decl) {
if (/px/.test(decl.value)) { if (/px/.test(decl.value)) {

View File

@ -63,6 +63,7 @@ export default {
</style> </style>
<style lang='less' scoped> <style lang='less' scoped>
.index { .index {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;

View File

@ -3,7 +3,7 @@ module.exports = {
plugins: [ plugins: [
require('./buildPlugins/pxresize')({ require('./buildPlugins/pxresize')({
scale: 0.5, scale: 0.5,
ignore: ['manager'] ignore: ['manager', 'node_modules']
}) })
] ]
}; };