The internal `registerPlugins()` API is used to enable backwards compatibility with v3 plugins and configs and it is called on every build even when no v3 plugins or configs are used. This function has a non-trivial cost in that case — around 5ms. So this PR does a few things: ## Implements a simpler, faster `theme(…)` function We now have a much simpler `theme(…)` function that can be used when backwards compatibility is not necessary. It still supports many of the same features: - The modern, v4 style CSS variable syntax `theme(--color-red-500)` - The legacy, v3 path style `theme(colors.red.500)` - And the v3-style alpha modifier `theme(colors.red.500 / 50%)` - Path upgrades so things like `theme(accentColor.red.500)` pulls from `--color-red-500` when no `--accent-color-red-500` theme key exists When you do have plugins or configs the more advanced `theme(…)` function is swapped in for more complete backwards compatibility. ## `registerPlugins` registers globs Before `registerPlugins` passed the `ResolvedConfig` out so we could register globs in `compile()`. Since that one function is really the main driver for backwards compat we decided to move the content path registration into `registerPlugins` itself when it comes to paths provided by plugins and configs. This is an internal implementation detail (well this entire PR is) but it's worth mentioning. This method is used to resolve a theme value from a theme key. ## `registerPlugins` is now only called when necessary All of the above work made it so that `registerPlugins` can be called only as needed. This means that when no v3 plugins or configs are used, `registerPlugins` is never called thus elminating the performance impact of config resolution. --------- Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| @tailwindcss-cli | ||
| @tailwindcss-node | ||
| @tailwindcss-postcss | ||
| @tailwindcss-standalone | ||
| @tailwindcss-vite | ||
| internal-example-plugin | ||
| internal-postcss-fix-relative-paths | ||
| tailwindcss | ||
| tsconfig.base.json | ||