Skip to content

[v4] [email protected] postcss broken production build space-{x,y}-*, divide-{x,y}-* #16147

Closed
@pderiy

Description

@pderiy

What version of Tailwind CSS are you using?

What build tool (or framework if it abstracts the build tool) are you using?

What version of Node.js are you using?

What browser are you using?

  • Google Chrome 132.0.6834.111 (Official Build) (arm64)

What operating system are you using?

  • macOS

Reproduction URL

Steps to reproduce:

  • pull repo
  • npm install
    ----
  • npm run start (to run dev server)
  • Check the page. It should have spacing between lines. So it looks good
    ----
  • npm run build
  • cd dist/angular/browser
  • run http server (I'm using npm package "http-server")
  • Check the page. It doesn't have spacing right now. The problem is described in next scrtion.

Describe your issue
Install fresh angular project and add tailwind to it. Try "serve". It works fine. But when u create production build it compiles with some wrong selectors. Generally I found broken selectors which are using :where in their query. It just reorders them.
Check next examples:

  • tailwind@3 "ng build" css output [CORRECT]:
.space-y-6 > :not([hidden]) ~ :not([hidden]) {
  --tw-space-y-reverse: 0;
  margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
  margin-bottom: calc(1.5rem * var(--tw-space-y-reverse))
}
  • tailwind@4 "ng serve" output [CORRECT]:
  :where(.space-y-6 > :not(:last-child)) {
    --tw-space-y-reverse: 0;
    margin-block-start: calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));
    margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));
  }
  • tailwind@4 "ng build" output [INCORRECT]:
  .space-y-6 :where(>:not(:last-child)) {
    --tw-space-y-reverse: 0;
    margin-block-start: calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));
    margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))
  }
  • space-y-6 is out outside of :where with tailwind@4 and angular production build

Testing selector without tailwind with angular

I tried to add code:

  :where(.space-y-6 > :not(:last-child)) {
    --tw-space-y-reverse: 0;
    margin-block-start: calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));
    margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));
  }

to style.css file and create production build. And it works fine. It just doesn't work when tailwind/postcss adds it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions