Package Exports
- tailwindcss-patch
- tailwindcss-patch/dist/index.cjs
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 ! extract all classes into file!
Nodejs version should >=
16.6.0
Setup
- Install package
<yarn|npm|pnpm> add -D ts-patch- Patch tailwindcss
npx tw-patch install- Add
preparescript (keeps patch persisted after npm install)
package.json
{
/* ... */
"scripts": {
"prepare": "tw-patch install"
}
}Usage
Cli
Init Config File
tw-patch initThen there will be a ts file called tailwindcss-mangle.config.ts exist in your cwd.
Extract all class into a json
tw-patch extractdefault there will be a json in .tw-patch/tw-class-list.json in your project.
you can custom this behavior by config tailwindcss-mangle.config.ts
Nodejs
import { TailwindcssPatcher } from 'tailwindcss-patch'
const twPatcher = new TailwindcssPatcher(/* options */)
// get all contexts at runtime
twPatcher.getContexts()
// get all class generated by tailwindcss utilities
twPatcher.getClassSet()Migration form v1 to v2
0. cli command change
{
- "tw-patch"
+ "tw-patch install"
}1. default remove * in json array result
[
- "*",
"text-[99px]",
"text-[100px]"
]