npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

media-px2rem

v0.1.3

Published

Add media query breakpoint for postcss-px2rem

Downloads

11

Readme

install

$ npm/cmpn install media-pxtorem --save-dev

options

  • rootValue: (Number) 1rem = rootValue; 默认值: 16
  • unitPrecision: (Number) rem的小数点的计算精度;默认值: 5
  • propList: (Array) 需要转化rem的属性,默认值 ["font", "font-size", "line-height", "letter-spacing"]
  • replace: (Boolean) 是否需要替换原有样式,默认值: true,开发阶段建议使用false;
  • mediaQuery:(Boolean) 是否需要替换 媒体查询参数中的px,默认值: false;
  • minPixelValue:(Number) 转化的最小值(px),是基于样式中的px转化的,而不是基于已转换的rem换算px后计算;默认值0
  • exclude: (String, Regexp, Function) ,排除的样式文件路径,默认值: null
  • mediaMinWidth:(Number) 转化的区间的起点(响应方式为移动端优先),默认值:0, 转化所有px; eg: 1024,转化1024以及1024以上的区间;

how to use

  • rem的计算方式:已1920设计稿基准下: 1rem = 48px;以1024等比缩放 1rem = 25.6作为最小值;避免移动端使用自动转化;
  • 建议只针对 1024/1200 以上区间开始rem自动转化,手机端转化等比会导致排版失调: 比如:栏目标题36px , 内容简介16;
  • 内容区按照正常PX实现,避免小屏等比缩放过渡,比如: 1200的内容区,等比缩放内容区会是853.75px;严重影响布局以及预览效果;
  • 合理使用,建议仅 font-size,line-height, padding, margin 做自动转换;
  • 对于自动转化后,区间字体过小,还原度较低的问题,可以在 html动态设置 {font-size: val !important;}的方式调整解决;
  • 如果所有属性转为为rem,可以解决日常提到的等比缩放,以及浏览器放大缩小的问题;

TODO

[] 对于14,16等通用文本的字体大小,不能使用等比的方式处理;