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

@opends/tailwind

v1.0.2

Published

A Tailwind Plugin to use out of the box Open Design System schema

Downloads

12

Readme

The official Open Design System Tailwind CSS Plugin provides the easiest way to have access to your Design System tokens into Tailwind CSS.

module.exports = {
  content: ['./app/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
  plugins: [
    require('@opends/tailwind'),
    //...
  ],
}

Instalation

Install the plugin from npm:

npm install -D @opends/tailwind

Then add the plugin to your tailwind.config.js file:

/** @type {import('tailwindcss').Config} */
module.exports = {
  theme: {
    // ...
  },
  plugins: [
    require('@opends/tailwind')({
      designSystemConfig: 'config/open-design-system.json', // optional defaults to root to project.
    }),
    // ...
  ],
}

Basic Usage

Once your open-design-system.json file is loaded all yourt tokens are available as TailwindCSS utilities and CSS variables.

<div class="box">
  <h1 class="text-title text-primary">My amazing title here</h1>
</div>

The Open Design System plugin extends the TailwindCSS configuration to allow users to still keep usage of any TailwindCSS option and being just an extra layer for it.

Colors

All colors are added in a way that they can be used by tailwind internally.

<p class="text-primary">The quick brown fox jumps over the lazy dog.</p>

The aforementioned example assumes you already have a primary color set.

With the example above, you should be able to use out of the box your light and dark version of the primary color.

Typography

<p class="text-body font-body">The quick brown fox jumps over the lazy dog.</p>

The aforementioned example assumes you already have a body typography set.

With the example above, everything that you have defined for your typography should be available under the name of the typography you set in your open-design-system.json and it should set all the properties for you (fontFamily, fontSize, fontWeight, letterSpacing and so on.)

Spacings

<div class="p-big m-small">
  <!-- ... -->
</div>

The aforementioned example assumes you already have a big and small spacing set.

Every place you can specify some spacings in TailwindCSS you should be able to use the tokens you have defined in the open-design-system.json.

For WEB we assume px as for spacing. In case you would like to extend such functionality open an issue for discussion.

Surfaces

<div class="box">
  <!-- ... -->
</div>

The aforementioned example assumes you already have a box surface set.

Surfaces are available as component classes, so you can use already all the configurations you did under a single class. But it also creates css variables using the schema: --surface-{surface-name}-border-radius and it is used for all the properties.

Shadows

<div class="shadow-elevation1">
  <!-- ... -->
</div>

Shadows also extends the current theme and include the shadows (box shadow) availabel for your usage