Skip to content

[v4] Removing default breakpoints not reflected in plugin() API/method #16130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
flx-sta opened this issue Jan 31, 2025 · 6 comments
Open

[v4] Removing default breakpoints not reflected in plugin() API/method #16130

flx-sta opened this issue Jan 31, 2025 · 6 comments
Labels

Comments

@flx-sta
Copy link

flx-sta commented Jan 31, 2025

What version of Tailwind CSS are you using?

v4.0.1

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

  • @tailwindcss/cli 4.0.0
  • @tailwindcss/postcss 4.0.0
  • postcss 8.5.1

What version of Node.js are you using?

For example: v12.0.0

What browser are you using?

v20.13.0

What operating system are you using?

macOS 14.6.1 (23G93)

Reproduction URL

https://codesandbox.io/p/live/27a50c21-9a15-410a-be6e-f846fdbb6102

Run the build script and check the terminal output.

Describe your issue

When defining my @theme with :

@theme {
  --breakpoint-*: initial;

  --breakpoint-phone: 30rem;
  --breakpoint-tablet: 48rem;
  --breakpoint-default: 75rem;
}

I was expecting for only my custom breakpoints/screens to exist.
But instead it's adding them on top of the existing one when definition a plugin:

{
  sm: '40rem',
  md: '48rem',
  lg: '64rem',
  xl: '80rem',
  '2xl': '96rem',
  phone: '30rem',
  tablet: '48rem',
  default: '75rem',
  __CSS_VALUES__: { phone: 0, tablet: 0, default: 0 }
}
≈ tailwindcss v4.0.1

Done in 113ms

Unless, is it expected to use the __CSS_VALUES__ object?

@philipp-spiess
Copy link
Member

Hey! Yeah this is a limitation of the current backwards compatibility layer as we have to keep an object with the full legacy defaults around and are extending it in the compatibility layer. I'm curious to know what you're building with the plugin API though to see how we can better support this?

@flx-sta
Copy link
Author

flx-sta commented Feb 4, 2025

We are generating classes & variables to be used inside a file-generator and use the exposed objects to extract the available keys.

@philipp-spiess
Copy link
Member

@flx-sta Ah, so you have a Tailwind plugin that runs as part of the build steps and spits out other files as side-effects?

The better v4 solution here would be to read CSS variables from the --breakpoint-* namespace at runtime. Would that be possible?

@flx-sta
Copy link
Author

flx-sta commented Feb 4, 2025

@flx-sta Ah, so you have a Tailwind plugin that runs as part of the build steps and spits out other files as side-effects?

Correct

The better v4 solution here would be to read CSS variables from the --breakpoint-* namespace at runtime. Would that be possible?

What do you mean with "at-runtime"? Do you mean reading them with something like .getPropertyValue('--var');?

@philipp-spiess
Copy link
Member

What do you mean with "at-runtime"? Do you mean reading them with something like .getPropertyValue('--var');?

Yeah that's what I thought of. Wonder how those files end up being used.

@flx-sta
Copy link
Author

flx-sta commented Feb 4, 2025

What do you mean with "at-runtime"? Do you mean reading them with something like .getPropertyValue('--var');?

Yeah that's what I thought of. Wonder how those files end up being used.

I'm limited in what I am allowed to tell, sorry (NDA).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants