px转rem fis版:fis-postprocessor-px2rem
发布于 8 年前 作者 younth 5466 次浏览 来自 分享

移动端布局淘宝的lib-flexible flexible应该是目前最适合的了,我们这边也在进行推广。由于之前业务线大部分都是基于fis构建,昨天简单实现了个px2rem的fis版本 fis-postprocessor-px2rem 用fis进行构建的移动端项目可以考虑使用,自动将px按照注释规范转成对应rem。

Pre processing:

One raw stylesheet: test.css

.selector {
    width: 150px;
    height: 64px; /*px*/
    font-size: 28px; /*px*/
    border: 1px solid #ddd; /*no*/
}

After processing:

Rem version: test.css

.selector {
    width: 2rem;
    border: 1px solid #ddd;
}
[data-dpr="1"] .selector {
    height: 32px;
    font-size: 14px;
}
[data-dpr="2"] .selector {
    height: 64px;
    font-size: 28px;
}
[data-dpr="3"] .selector {
    height: 96px;
    font-size: 42px;
}
1 回复

这个棒棒哒,如果内容足够多,可以精华的

回到顶部