JSPM

  • Created
  • Published
  • Downloads 3332
  • Score
    100M100P100Q118824F
  • License MIT

patch tailwindcss for exposing context

Package Exports

  • tailwindcss-patch
  • tailwindcss-patch/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tailwindcss-patch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

tailwindcss-patch

get tailwindcss context at runtime!

Setup

  1. Install package
<yarn|npm|pnpm> add -D ts-patch
  1. Patch tailwindcss
npx tw-patch
  1. Add prepare script (keeps patch persisted after npm install)

package.json

{
  /* ... */
  "scripts": {
    "prepare": "tw-patch"
  }
}

Usage

import { getContexts, getClassCacheSet } from 'tailwindcss-patch'
// get all contexts at runtime
getContexts()
// get all class generated by tailwindcss utilities
getClassCacheSet()

Notice

getContexts,getClassCacheSet should be invoked after postcss-loader's activation.

which means you may not get tailwindcss contexts at build start time.

you may call them at generateBundle lifetime hook in vite/webpack plugin.