Code Monkey home page Code Monkey logo

px_to_rpx's Introduction

px_to_rpx

对于在微信小程序中写rpx时往往要自己计算,在设计稿为375px或者750px宽度的情况下自己算还可以,但是这次我遇到了设计图只有414px宽度的情况,于是我利用正则表达式提取px数据计算后替换成了rpx数据,于是把程序分享出来

使用getPx方法传入设计图的宽度,你想转换css文件或者wxss文件的路径和输出文件的路径,会将文件中所有的px单位和数据根据宽度转换为对于的rpx的数据和单位。 比如在css中 width : 100px;你传入的设计稿宽度为375px,该程序会转换为 width : 200 rpx; 代码再master分支上,我暂时还不会用git

px_to_rpx's People

Contributors

hardlif avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.