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

@sassywares/medic

v1.0.2

Published

Medic πŸš‘ is a minimal Tailwind Plugin that brings consistent, cross-breakpoint utilities to your applications. No need to set random padding and margin values, Medic's ergonomic API (stuff like p-layout) makes it easy to create consistent layouts across y

Downloads

3

Readme

Medic πŸš‘

npm version Builds

Medic πŸš‘ is a minimal Tailwind Plugin that brings consistent, cross-breakpoint utilities to your applications. No need to set random padding and margin values, Medic's ergonomic API (stuff like p-layout) makes it easy to create consistent layouts across your application. Medic πŸš‘ is built using Crust, a simple boilerplate for creating and publishing packages to NPM.

Getting Started

  1. Install Medic πŸš‘ using your package manager of choice:
npm install @sassywares/medic
yarn add @sassywares/medic
pnpm add @sassywares/medic
  1. Add Medic πŸš‘ to your Tailwind config file:
// tailwind.config.js
module.exports = {
  // ...
  plugins: [
    // ...
    require('@sassywares/medic'),
  ],
};
  1. Now add the following to your tailwind config file:
// tailwind.config.js
module.exports = {
  // ...
  theme: {
    // ...
    extend: {
      // ...
      theme: {
        spacing: {
            "2xs": "4px",
            xs: "8px",
            sm: "12px",
            base: "16px",
            md: "20px",
            lg: "24px",
            xl: "28px",
            "2xl": "32px",
            "3xl": "36px",
            "4xl": "40px",
            },
        },
    },
  },
};

These spacing values are used by Medic πŸš‘ to create the spacing utilities. You can modify these values to suit your needs. If the default values look good to you, you can simply add medic as a preset to your tailwind config file, this way you don't need to do anything else.

// tailwind.config.js
module.exports = {
  // ...
  presets: [
    // ...
    require('@sassywares/medic/preset'),
  ],
};

The Problem

When building applications, you often need to set padding, margin, and gap values for your elements. You also need to set these values for different breakpoints. This can be a tedious process and you have to be consistent or your UI components are going to be not as sassy as they should. I'm referring to stuff like gap-3 md:gap-4 lg:gap-5 for, maybe a card's content, and then repeating the same thing for every single card in your application, and then one day you decide to change the gap value for the medium breakpoint and you have to go through every single card and change the value. This is not fun and it's error-prone.

The Solution

Medic πŸš‘ solves this problem by providing a set of ergonomic utilities that make it easy to create consistent layouts across your application. Simply say gap-card and you have all 3 values set for you. No need to set random padding, margin, or gap values, Medic πŸš‘ has you covered.

Usage

Medic πŸš‘ breaks down your layouts into three layers: layouts, cards, and elements. Each layer has its own set of utilities that you can use to create consistent layouts across your application.

<article class="p-card">Card</article>

The above class will apply the following styles to the element:

.p-card {
  padding: 16px;
}

@media (min-width: 768px) {
  .p-card {
    padding: 20px;
  }
}

@media (min-width: 1024px) {
  .p-card {
    padding: 24px;
  }
}

You can do the same for layouts and elements:

<section class="p-layout">Layout</section>
<div class="p-element">Element</div>

Which layer to use?

Use the p-layout layer for your main layout elements like header, main, section, footer, etc. Use the p-card layer for your card elements like article, aside, div, etc. Use the p-element layer for your other elements like wrappers of button, input, a, etc.

I think of it like this: layouts are your grids, cards are your boxes, and elements are anything that goes inside the boxes.

Which properties are included?

Medic πŸš‘ includes the following properties for each layer:

  • p: "padding"
  • pt: "padding-top"
  • pr: "padding-right"
  • pb: "padding-bottom"
  • pl: "padding-left"
  • m: "margin"
  • mt: "margin-top"
  • mr: "margin-right"
  • mb: "margin-bottom"
  • ml: "margin-left"
  • gap: "gap"
  • "gap-x": "column-gap"
  • "gap-y": "row-gap"
  • "top": "top"
  • "right": "right"
  • "bottom": "bottom"
  • "left": "left"

Need more properties? Please open an issue or a pull request.

Contributing

Medic πŸš‘ comes from the community for the community. I made Medic to solve my own problems, but I'm sure there are other people out there who have the same problems. If you have any ideas on how to improve Medic πŸš‘, please open an issue or a pull request. I'm always open to new ideas.

License

Medic πŸš‘ is open source software released under the MIT License. We encourage you to use, modify, and distribute Medic as you see fit.