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

@danielfgray/tw-heropatterns

v0.1.6

Published

tailwindcss jit plugin for dynamically generating heropatterns

Downloads

53

Readme

tw-heropatterns

tailwindcss plugin for dynamically generating heropatterns

Warning: This plugin depends on experimental and undocumented features of Tailwind, the API is subject to change between versions.

Why?

  • heropatterns created by Steve Schoger is a dynamic web app which allows the user to interactively pick the colors for a pattern and then copy/paste into their project. It's fantastic, but opening up the browser and picking the colors and opacity isn't as nice as just writing a CSS class.
  • tailwind-heropatterns is a Tailwind plugin that lets you define specific heropatterns and colors in a Tailwind config file and then generates all the possible combinations you could use, later to be purged but will still be added to the stylesheet and parsed by the browser during development, and bigger CSS files start to slow down browser development tools.

This plugin leverages the new experimental JIT engine in Tailwind to only generate the patterns with the given opacity and color that you use in your classes, without generating unused combinations.

Install

Install it from npm using your package manager of choice, for example:

npm install tailwindcss @danielfgray/tw-heropatterns
# or
yarn add tailwindcss @danielfgray/tw-heropatterns

If you don't have a tailwind.config.js file, generate one with:

npx tailwindcss init --jit
# or
yarn tailwindcss init --jit

Enable the JIT mode and add the plugin to the list:

module.exports = {
  mode: "jit",
  purge: [...], // purge is required for jit to work
  plugins: [
    //...
    require("@danielfgray/tw-heropatterns"),
  ]
}

Usage

bgp-patternName-[color,opacity]

for example

<div class="bg-gray-900 bgp-topography-[gray.700,.5]">

opacity is optional, and defaults to 1, so the following are the equivalent:

bgp-floatingCogs-[gray.700,1]
bgp-floatingCogs-[gray.700]

Design Limitations

Ideally I wanted to leverage Tailwind's bg-opacity feature instead of having an extra variable in the class, but due to the nature of the patterns being URL-encoded SVGs, the generated URL string has no mechanism reference the css variable, and there is no way to access the list of "sibling classes" at compile time that I know of.

Patterns

All of the patterns in heropatterns should be available in this plugin in camelCased form:

  • anchorsAway
  • architect
  • autumn
  • aztec
  • bamboo
  • bankNote
  • bathroomFloor
  • bevelCircle
  • boxes
  • brickWall
  • bubbles
  • cage
  • charlieBrown
  • churchOnSunday
  • circlesAndSquares
  • circuitBoard
  • connections
  • corkScrew
  • current
  • curtain
  • cutout
  • deathStar
  • diagonalLines
  • diagonalStripes
  • dominos
  • endlessClouds
  • eyes
  • fallingTriangles
  • fancyRectangles
  • flippedDiamonds
  • floatingCogs
  • floorTile
  • formalInvitation
  • fourPointStars
  • glamorous
  • graphPaper
  • groovy
  • happyIntersection
  • heavyRain
  • hexagons
  • hideout
  • houndstooth
  • iLikeFood
  • intersectingCircles
  • jigsaw
  • jupiter
  • kiwi
  • leaf
  • linesInMotion
  • lips
  • lisbon
  • melt
  • moroccan
  • morphingDiamonds
  • overcast
  • overlappingCircles
  • overlappingDiamonds
  • overlappingHexagons
  • parkayFloor
  • pianoMan
  • pieFactory
  • pixelDots
  • plus
  • polkaDots
  • rails
  • rain
  • randomShapes
  • roundedPlusConnected
  • signal
  • skulls
  • slantedStars
  • squares
  • squaresInSquares
  • stampCollection
  • steelBeams
  • stripes
  • temple
  • texture
  • ticTacToe
  • tinyCheckers
  • topography
  • volcanoLamp
  • wallpaper
  • wiggle
  • xEquals
  • yyy
  • zigZag