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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wolves.ink/tailwindcss-fluid-fontsize

v1.0.1

Published

A plugin to have an easy way to create dynamic font-sizes.

Downloads

149

Readme

Tailwindcss Fluid FontSize

A plugin to have an easy way to create dynamic font-sizes.

👉🏻 Installation

Install the plugin from npm:

# Using pnpm
pnpm install -D @wolves.ink/tailwindcss-fluid-fontsize

# Using npm
npm install -D @wolves.ink/tailwindcss-fluid-fontsize

# Using Yarn
yarn add -D @wolves.ink/tailwindcss-fluid-fontsize

Then add the plugin to your tailwind.config.js file and do your settings if you're not happy with the defaults:

// tailwind.config.js
module.exports = {
  plugins: [
    require("@wolves.ink/tailwindcss-fluid-fontsize")(),
    // ...
  ],
};

👉🏻 Usage

When not setting a prefix you can use the default font sizing classes.

<article>
  <h1 class="text-xl">Fluid font-size</h1>
</article>

👉🏻 Configuration

The plugin comes with a default configuration (see below) but it's possible to customize this config for your project. As default, we use rem for better accessibility, but you can also use px.

Without setting a prefix the normal css text-xx classes will be overwritten.

When defining a fluidFontSize the first value will be used up to the screenMin value. Between the screenMin and screenMax the font will scale linear from the fist value set on the size up to the second value. When the screen is larger than screenMax the font size will be the second value.

Default configuration

// tailwind.config.js
module.exports = {
  theme: {
    fluidFontSize: {
      xs: [0.75, 0.75],
      sm: [0.875, 0.875],
      base: [1, 1],
      lg: [1, 1.125],
      xl: [1, 1.25],
      "2xl": [1.25, 1.5],
      "3xl": [1.5, 1.875],
      "4xl": [1.75, 2.25],
      "5xl": [2, 3],
      "6xl": [2.5, 3.75],
      "7xl": [2.75, 4.5],
      "8xl": [3, 6],
      "9xl": [4, 8],
    },
  },
  plugins: [
    require("@wolves.ink/tailwindcss-fluid-fontsize")({
      screenMin: 20, // 20rem === 320px
      screenMax: 96, // 96rem === 1536px
      unit: "rem", // default is rem but it's also possible to use 'px'
      prefix: "", // set a prefix to use it alongside the default font sizes
    }),
  ],
};

Acknowledgements

There is already a fluid type plugin, but there is no fine grain control for different heading sizes