Giter Site home page Giter Site logo

mpt-loader's Introduction

webpack loader 移动端多分辨率自适应

安装

npm install mpt-loader --save-dev

query配置

queryList

需要支持的分辨率宽度,不包括baseWidth,默认[]

uiWidth

UE给到标注的PSD宽度,默认720

baseWidth

基础支持的分辨率宽度,默认320

示例

/* 输入src/test.css */
/* 自定义单位: mpt */
/* UE标准最佳分辨率宽度720 */
/* 前端基本最佳分辨率宽度320 */
/* 前端需要支持的其他最佳分辨率宽度列表:360, 414 */
/* 单位换算公式: 实际像素 = (输入规则值mpt / 720) * 最佳分辨率宽度 */

.container {
    width: 720mpt;
    border: 1px solid #eee;
}
.navigator {
    width: 720mpt;
    height: 120mpt;
}

/* 输出dist/test.css */
/* 生成单位: px */
.container {
    width: 320px; /* (720 / 720) * 320 */
    border: 1px solid #eee;
}
.navigator {
    width: 320px; /* (720 / 720) * 320 */
    height: 53px; /* (120 / 720) * 320 */
}
@media screen and min-width(360px) {
    .container {
        width: 360px; /* (720 / 720) * 360 */
    }
    .navigator {
        width: 360px; /* (720 / 720) * 360 */
        height: 60px; /* (120 / 720) * 360 */
    }
}
@media screen and min-width(414px) {
    .container {
        width: 414px; /* (720 / 720) * 414 */
    }
    .navigator {
        width: 414px; /* (720 / 720) * 414 */
        height: 69px; /* (120 / 720) * 414 */
    }
}

mpt-loader's People

Watchers

 avatar  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.