Repository navigation
Pass the CSS entrypoint to canonicalize as --css - #10
Merged
Merged
Conversation
`tailwindcss canonicalize` names its entrypoint `--css`. It has done so since the subcommand was introduced (tailwindlabs/tailwindcss#19783) and has never accepted `--input`, which it drops silently and exits 0 on. So every canonicalization ran against the stock `@import "tailwindcss"` design system instead of the project's, regardless of whether the path came from `canonical_tailwind: [input: ...]` or was discovered in a tailwind profile's `args`. That is the symptom v0.3.1 fixed for the split `--input path` form: the path is now found, but it was still handed over under a flag the CLI ignores, so the `@theme` and plugins stayed out of reach through every path. The profile's entrypoint still arrives spelled `--input`, because that is the flag `tailwindcss` takes when *building*; only the flag handed to `canonicalize` changes. The existing fixtures are both stock `@import "tailwindcss"`, under which a dropped `--input` and an honoured `--css` produce identical output, which is why the suite could only assert the argv. test/fixtures/themed.css drops the `sm` breakpoint and redefines `sm` as a max-width variant, so `min-[40rem]:flex` collapsing to `sm:flex` now fails the suite rather than passing it. Green against both the supported floor (4.2.2) and the current CLI (4.3.3).
Owner
|
Thanks for catching this and adding the regression test, @leoherbie. Merged! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tailwindcss canonicalizenames its CSS entrypoint--css. It has done so since the subcommand was introduced (tailwindlabs/tailwindcss#19783) and has never accepted--input— it drops the flag silently and exits 0.CanonicalTailwind.Config.resolve_input/2emits--input=<path>on both branches, so the entrypoint never reaches the CLI and every canonicalization runs against the stock@import "tailwindcss"design system instead of the project's — whether the path came fromcanonical_tailwind: [input: ...]or was discovered in a tailwind profile'sargs.That is the same symptom v0.3.1 fixed for the split
--input pathform ("canonicalization ran without the project's@themeand plugins"): the path is now found, but it is still handed over under a flag the CLI ignores, so the theme stays out of reach through every path.What it looks like
Our
assets/css/app.cssdrops the defaultsmbreakpoint and redefinessmas a max-width variant:With that entrypoint,
min-[40rem]:is amin-widthquery andsm:is amax-widthone — not spellings of each other.mix formatrewroteto
class="p-4 sm:flex", inverting the breakpoint. Running the pinned CLI by hand:canonicalize --helpon 4.3.3 lists--css,--format,--stream,-hand nothing else.The change
resolve_input/2and the twofind_profile_input/1head clauses emit--css=instead of--input=. The profile's entrypoint still arrives spelled--input, because that is the flagtailwindcsstakes when building — only the flag handed tocanonicalizechanges. Sincecanonicalizehas taken--cssfor its whole existence, this is safe across the supported range rather than version-dependent.Why the suite did not catch it
test/fixtures/input.cssandtest/fixtures/other.cssare both stock@import "tailwindcss", under which a dropped--inputand an honoured--cssproduce byte-identical output — so the tests could only assert the argv, which was self-consistently wrong. This addstest/fixtures/themed.csswith the@theme/@custom-variantabove and a test that canonicalizesmin-[40rem]:flex p-4through it; collapsing tosm:flexnow fails the suite. Green against both the supported floor (4.2.2) and the current CLI (4.3.3).Happy to drop the CHANGELOG entry or reword it if you'd rather keep that yours.