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

toem-tailwind-plugin

v0.1.0

Published

A Tailwind plugin for dynamically calculate em values.

Readme

toem Tailwind Plugin

A Tailwind plugin for dynamically calculate em values.

Install

npm install toem-tailwind-plugin

Then you just need to import it and add it to the plugins array in your tailwind.config.js.

import toemPlugin from 'toem-tailwind-plugin'

export default {
  /* ...your tailwind config goes here... */
  plugins: [
    toemPlugin(
      {
        /* Optional */
        defaultBase: 16 /* Default value is: 16 */
      }
    )
  ]
}

How to use it?

The em unit is relative to the font-size of its parent element as the MDN Web Docs defines it. These are kind of hard to guess its real computed value specially if you have numbers like 0.8125em. This library allows you to define em values with Tailwind but in a much more declarative way like the example below 👇.

how to use it In this example we are aiming to set a padding of 8px when the parent font-size is 16px resulting in 13px/16px = 0.8125em. Here's a code snippet using toem-tailwind-plugin in the wild. See? Much more explicit.

<div class="text-base flex items-center gap-x-em-[24/16]">
  <img class="size-em-[32/16]" src="..." alt="profile pic" />

  <p class="text-em-[13/16]">
    Lorem Ipsum
  </p>
<div>

If you find yourself setting the same exact base value for large chunks of code, or if you want to make a whole block interoperable with multiple bases. You can use single value -em classes for that. It results on a calc() function that inherits the base value from it's parent and defaults to your base value defaultBase on your plugin config. The base-em class sets a base value for the entire child block.

how to use it with single value

Here's the same example as before but using base-em class.

<div class="text-base base-em-[16] flex items-center gap-x-em-[24]">
  <img class="size-em-[32]" src="..." alt="profile pic" />

  <p class="text-em-[13]">
    Lorem Ipsum
  </p>
<div>

Preview the result

I highly recommend installing the Tailwind IntelliSense plugin for VSCode, it will display the result of the dynamic calculation.

intellisense

Supported properties

All the Tailwind classes that target css properties that accept em units as values are supported, but if I missed one feel free to open a PR.