Use tailwindcss-patch 2.x
to extract your classNames
#11827
sonofmagic
started this conversation in
Show and tell
Replies: 1 comment
-
I want this feature very badly, to build an optimized build pipeline that can skip rebuilding Tailwind if some files changed, but not the actual list of classes in those files. But I'm not too keen on "patching" my Tailwind version as advertised here. Is there any chance we can get a feature like this (extract the list of found classes and write it somewhere, say a JSON file) in upstream Tailwind? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Use
tailwindcss-patch 2.x
to extract your classNamestailwindcss-patch
is an extension to thetailwindcss
ecosystem. It is also an important part of thetailwindcss-mangle
project.I recently released
2.x
version oftailwindcss-patch
, which adds a configuration file reading and tool class name extraction feature.Let's see how to use it. It's fairly simple!
tailwindcss-patch 2.x
to extract your classNamesSetup
prepare
script (keeps patch persisted after npm install)package.json
Usage
Cli
Extract all class into a json
default 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 API
Config
Init Config File
Then there will be a ts file called
tailwindcss-mangle.config.ts
exist in yourcwd
.The config as follows:
you can custom
tw-patch
behavior bypatch
option:What's next?
At the moment I just extracted all the tool classes to actually get the context of
tailwindcss
to analyze. You can add more functionality to this project by giving meissue
orpr
.Of course, the extracted
JSON
isn't just for you to look at. You can analyze it, and I use it as a data file for mytailwindcss-mangle
.The
tailwindcss-mangle
itself is an obfuscation tool to obfuscate the tools generated bytailwindcss
, see the next article for more details on how to use it.Beta Was this translation helpful? Give feedback.
All reactions