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

create-a-scale

v1.0.7

Published

A CLI to build css styles for typography and spacing.

Readme

create-a-scale

A simple CLI to generate a typography and spacing css file to keep your design consitent.

How it works


First off, you'll need node and npm installed, the simplest way to do that is to use Volta.

To install the tool globally run this command:

npm i -g create-a-scale

Once it's installed all you have to do is run:

create-a-scale

You'll be prompted for the required information.

The output of this command would be:

:root {
  --b: 16px;
  --xs: 21.328px;
  --s: 28.430224px;
  --m: 37.897488591999995px;
  --l: 50.51735229313599px;
  --xl: 67.33963060675028px;
}

.b {
  font-size: var(--b);
  margin-bottom: var(--b);
  line-height: calc(var(--b) * 1.333);
}

.xs {
  font-size: var(--xs);
  margin-bottom: var(--b);
  line-height: calc(var(--xs) * 1.333);
}

.s {
  font-size: var(--s);
  margin-bottom: var(--b);
  line-height: calc(var(--s) * 1.333);
}

.m {
  font-size: var(--m);
  margin-bottom: var(--b);
  line-height: calc(var(--m) * 1.333);
}

.l {
  font-size: var(--l);
  margin-bottom: var(--b);
  line-height: calc(var(--l) * 1.333);
}

.xl {
  font-size: var(--xl);
  margin-bottom: var(--b);
  line-height: calc(var(--xl) * 1.333);
}

The output provides you with css variables and some utility classes for font sizes to use however you like. All built around the two values you initially provided.

Config options


If you want to skip the prompts you can run the command by passing in some arguments they are:

  1. --out: The name you want to give you file (defaults to scale.css)
  2. --size: The base size you want to start with (you'll be prompted for this if you don't provide a value).
  3. --scale: The scale to apply to the base size (you'll be prompted for this if you don't provide a value).
  4. --break: Breakpoints to scale up for. Under the hood this will use media queries with a min-width of the value you provide, can add as many as you want.

An example with all of these options:

  create-a-scale --out type-scale.css --size 16 --scale 1.2 --break 960 --break 1200

This would output a file called type-scale.css in your current directory that looked like this:

:root {
  --b: 16px;
  --xs: 19.2px;
  --s: 23.04px;
  --m: 27.648px;
  --l: 33.1776px;
  --xl: 39.81312px;
}

@media (min-width: 960px) {
  :root {
    --b: 19.2px;
    --xs: 23.04px;
    --s: 27.648px;
    --m: 33.1776px;
    --l: 39.81312px;
    --xl: 47.775743999999996px;
  }
}

@media (min-width: 1200px) {
  :root {
    --b: 23.04px;
    --xs: 27.648px;
    --s: 33.1776px;
    --m: 39.81312px;
    --l: 47.775743999999996px;
    --xl: 57.330892799999994px;
  }
}

.b {
  font-size: var(--b);
  margin-bottom: var(--b);
  line-height: calc(var(--b) * 1.2);
}

.xs {
  font-size: var(--xs);
  margin-bottom: var(--b);
  line-height: calc(var(--xs) * 1.2);
}

.s {
  font-size: var(--s);
  margin-bottom: var(--b);
  line-height: calc(var(--s) * 1.2);
}

.m {
  font-size: var(--m);
  margin-bottom: var(--b);
  line-height: calc(var(--m) * 1.2);
}

.l {
  font-size: var(--l);
  margin-bottom: var(--b);
  line-height: calc(var(--l) * 1.2);
}

.xl {
  font-size: var(--xl);
  margin-bottom: var(--b);
  line-height: calc(var(--xl) * 1.2);
}