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

css-profiler

v0.0.16

Published

A tool that runs static analysis with PostCSS for css files.

Readme

CSS-Profiler

CSS-Profiler is a PostCSS Cli tool to analysis CSS code quality, find its problems, and generate a report to guide developers write more clean, maintainable CSS code.

Features

  • 找出样式名(即选择器)完全相同的样式
  • 找到具有完全相同的内容的所有样式
  • 找出样式内容相似度在 70% 及以上的样式规则
  • 找出前 20 个名字最长的选择器
  • 支持 sourceMap 分析

使用

命令行用法

目前只支持分析单个 CSS 文件。

# install
$ npm i -g css-profiler

# analysis one or more css files
$ css-profile style.css
# result will display below.

Node.js API

TODO

const cssProfiler = require('css-profiler');

const cssContent = `
input {
  display: inline-block;
}
input {
  border: 1px solid #eee;
  padding: .2rem;
  box-sizing: border-box;
  width: 100%;
  display: block;
}
button {
  background: aquamarine;
  border: none;
  margin-top: .2rem;
  display: block;
  width: 100%;
  box-sizing: border-box;
}`;

let result = cssProfiler(cssContent);

原理

可能造成代码重复的原因有:

  • 写代码的时候发懒,复制了已有代码
  • scoped 机制的使用不恰当
  • 构建过程出现了问题
  • 使用预/后处理器时,重复引入某个 css 源文件

Author

zilong-thu