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

twprops

v2.1.19

Published

A CSS library mixing OpenProps usage and TailwindCSS naming and units

Downloads

129

Readme

TajilwindProps

What is this?

A CSS library of predefined variable names similar to TailwindCSS naming and similar to OpenProps system with minor deviations from the naming scheme.

Why did I make this?

I was using Tailwind in some of my projects, and Open Props in my project before. I liked Tailwind and the naming and units were perfect but I felt like the HTML was too messy. I liked Open Props too but I preferred the naming and units of Tailwind. With this, it is the same concept as Open Props but with Tailwind's naming and units

What does it help you with?

It forces you to write more consistent code using variables instead of using magic numbers.

How does it compare with other tools?

Using Tailwind's @apply feature is quite similar but you have to do more config. @apply isn't reccomended either and might be deprecated in the future. Using Open Props is similar too but it doesn't have the naming and units of Tailwind

Who can use this and take advantage of it?

Anyone who is writing CSS. Inline styles, Sass, Tailwind arbitrary values, etc.

Browse CDN

Usage

Option 1 (NPM Package)

  1. Install the npm package npm i twprops

  2. Import the CSS file you need inside node_modules/twprops/

    @import "/node_modules/twprops/"

Option 2 (NPM Package + PostCSS JIT Props)

  1. Install PostCSS JIT Props
npm install postcss-jit-props
  1. Add the following lines of code inside your postcss.config.js
// postcss.config.js

Option 3 (Unpkg CDN)

  1. Add this line in your CSS
@import "https://unpkg.com/twprops/twprops.min.css"

Tooling & Autocomplete (VSCode Only!)

  1. Install this extension.

  2. Go inside the extensions tab (Ctrl + Shift + X).

  3. Find the extension.

  4. Click on the settings icon (cog) and a modal will appear.

  5. Click "Extension Settings".

  6. Go to "CSS Variables: Blacklist Folders" and open it inside settings.json.

  7. Delete the line that contains node_modules inside the array.

    "cssVariables.blacklistFolders": [
       // Some stuff here
       "**/node_modules",
       // Some stuff here also
    ],

Optimizing for Production

All of the variables take up atleast 600+ lines of code and is 14kb minified without Gzip nor Brotli compression. You can use PurgeCSS to remove all of the unused variables since TailwindProps doesn't have a just-in-time feature at the moment. Just use their docs instead of a guide here.

Demo Usage

Tailwind Version


<div class="w-full bg-red-400 h-full font-bold"> </div>

TailwindProps Version

<div> </div>

div {
    width: var(--spacing-full);
    height: var(--spacing-full);
    background-color: var(--red-400);
    font-weight: var(--font-bold);
}

Advantages

  • Less config
  • Framework agnostic
  • Best of both worlds! (Tailwind & OpenProps)

To-do

  • [x] Complete all variables
  • [ ] Make a website
  • [x] Make NPM package
  • [x] Write better docs
  • [ ] Get first contributor
  • [ ] Test for performanced compared to Tailwind, OpenProps, and TailwindProps
  • [x] Make more stuff consistent