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 🙏

© 2026 – Pkg Stats / Ryan Hefner

postcss-mbrem

v0.0.1

Published

postcss plugin

Readme

postcss-mbrem

PostCSS plugin

Install

With npm do:

npm install --save-dev postcss-mbrem

Input

.box {
  width: 100mm;
  height: 200mm;
  margin: 10mm 20mm;
}

Output

.box {
  width: 2.13333rem;
  height: 4.26667rem;
  margin: 0.21333rem 0.42667rem;
}

Options

  • width - 设计稿宽度(默认:750)
  • median - 中间值(默认:320/20)

Example

  var gulp = require('gulp');

  var postcss = require('gulp-postcss'),
      mbrem = require('gulp-mbrem');

  gulp.task('default', function() {
    var processors = [
          mbrem({width: 1125})
        ];
    return gulp.src(["./src/c/*.css"])
        .pipe(postcss(processors))
        .pipe(gulp.dest("./dest/c/"));
    });

Description

这个插件启发于一个简单的手机端需求。 开发中需要使用rem的适配方案,但在拿到设计稿后,我们测量元素尺寸、位置等得到的像素值每次需要通过计算再写入css,这样相当麻烦。 在使用了hotcss这个结解决方案后,省去了计算提高了开发效率。不过随之带来了新的问题,每次需要带入自定义的sass方程_rem2px_,受此影响,我想何不创造一种新的单位来直接书写,免去方程的书写,也汲取单位的换算在新的单位中,省时省力。所以通过PostCSS写了这个简单的插件。