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

mr-class-style-generators

v1.0.1

Published

A utility to apply inline styles from custom class names like mr-fs-[10vw]

Readme

mr-class-style-generators

A lightweight utility that dynamically generates and injects custom CSS classes like mr-fs-[10vw] at runtime. Inspired by utility-first CSS frameworks like Tailwind CSS, but with on-demand generation.

✨ Features

  • Dynamically supports font-size utility classes such as mr-fs-[12px], mr-fs-[5vw], etc.
  • Automatically scans the DOM for custom mr-* classes and injects the matching styles.
  • No need to predefine font-size utilities.
  • Fully customizable prefix (mr by default).

📦 Installation

npm install mr-class-style-generators

🚀 Usage

Import and run the utility after your DOM is loaded:

import ApplyMrStyles from 'mr-class-style-generators';

ApplyMrStyles(); // Call this once after the DOM is ready

You can also pass a custom prefix if you're using something other than mr:

ApplyMrStyles("custom-prefix");

🧩 Example

HTML:

<h1 class="mr-fs-[5vw]">Responsive Heading</h1>
<p class="mr-fs-[16px]">This paragraph uses 16px font size.</p>

JavaScript:

import ApplyMrStyles from 'mr-class-style-generators';

// Run after your content is mounted (e.g., in useEffect or DOMContentLoaded)
ApplyMrStyles();

This will generate and inject CSS like:

.mr-fs-\[5vw\] {
  font-size: 5vw;
}

.mr-fs-\[16px\] {
  font-size: 16px;
}

⚛️ React Example

You can call ApplyMrStyles inside a useEffect to dynamically apply styles after rendering.

import React, { useEffect } from 'react';
import ApplyMrStyles from 'mr-class-style-generators';

function App() {
  useEffect(() => {
    ApplyMrStyles();
  }, []);

  return (
    <div>
      <h1 className="mr-fs-[5vw]">Hello Responsive World</h1>
      <p className="mr-fs-[16px]">Styled using mr-class-style-generators</p>
    </div>
  );
}

export default App;

✅ Make sure ApplyMrStyles() is called after the elements are mounted into the DOM.

🔧 How It Works

  1. Scans all elements inside document.body for class names starting with mr- (or your custom prefix).
  2. Matches font-size utilities of the form mr-fs-[value].
  3. Escapes the class name properly and injects the corresponding CSS into a <style> tag in <head>.

📌 Supported Utilities

| Utility | Output CSS Property | |----------------|---------------------| | mr-fs-[size] | font-size: size |

Example: mr-fs-[3rem]font-size: 3rem

🛠️ Use Cases

  • Build scalable, responsive UIs with dynamic font sizes.
  • Reduce pre-defined utility bloat.
  • Add Tailwind-style utility features in vanilla or React apps.

⚠️ Notes

  • Only font-size (fs) is supported in the current version.
  • You must call ApplyMrStyles() after the elements are rendered.
  • Use only valid CSS values inside square brackets ([]).

📄 License

MIT


Made with 💙 to make dynamic styling easier!

mr-fonts-npm