Repository navigation
Add a --polyfills option to @tailwindcss/cli #20701
gustavohrm
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
compile()acceptspolyfills(Polyfills.None,AtProperty,ColorMix,All), but the CLI always compiles withPolyfills.All, and there is no flag to change it. I'd like a--polyfillsoption on@tailwindcss/cli, matching what #20036 proposes for the Vite plugin (#20038) and #20444 for@tailwindcss/postcss.Why
Since v4.3.3, every
color-mix()that reads avar()gets a fallback declaration plus an@supports (color: color-mix(in lab, red, red))block, and registered properties get an@layer propertiesfallback. For a project whose browser floor already has both features (Chrome 111+, Safari 16.4+, Firefox 128+, the same targets v4 documents), those bytes never apply.Measured with v4.3.4, minified with the CLI's own
--minify:Polyfills.All(CLI today)Polyfills.NoneThe only way to get the smaller output today is to drop the CLI and call
compile()from@tailwindcss/nodeyourself, re-creating the CLI's source scanning andoptimize()step. That works (the output is byte-identical to the CLI's withPolyfills.All), but it means depending on internal APIs for something a flag could do.Proposal
accepting
all(default, unchanged behavior),none,at-property, andcolor-mix, passed straight tocompile()'spolyfillsoption. The default staysall, so nothing changes for anyone who doesn't opt in.Related: #20038, #20036, #20444, #19445.
All reactions