Skip to content

l3ob/postcss-uni-px2rpx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

uniapp px2rpx

使用方法

npm i postcss-uni-px2rpx-exclude
//postcss.config.js文件的plugins加入 require('postcss-uni-px2rpx')
//示例:
const pkg = require('./package.json')
module.exports = {
    plugins: [
        require('postcss-uni-px2rpx-exclude')({
            exclude: /node_modules|folder_name/i
        }),//插入此行
        require('postcss-import'),
        require('autoprefixer')({
            browsers: pkg.browserslist,
            remove: false
        }),
        require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
    ]
}

功能

  • 空格rpx替换为rpx
  • px替换为rpx(需要px请写Px)
  • 增加exlude参数用来排除不需要转换的目录

作用范围

仅作用于style标签,template不生效

About

uniapp下的px2rpx postcss插件

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%