No description
Find a file
Robin Malfait a270e2c8f1
Remove automatic var(…) injection (#13657)
This PR is a continuation of #13537.

Currently we reverted the merged changes so that we can get a new alpha
version out without this change.

---

This PR removes automatic `var(…)` injection for arbitrary properties,
values and modifiers.

There are a few properties that use "dashed-ident" values, this means
that you can use `--my-thing` as-is without the `var(…)` around it.

E.g.:

```css
.foo {
  /* Notice that these don't have `var(…)` */
  view-timeline-name: --timeline-name; 
  anchor-name: --sidebar;
}
```

This causes issues because we are now injecting a `var(…)` where it's
not needed.

One potential solution is to create a list of properties where dashed
idents can be used. However, they can _also_ use CSS custom properties
that point to another dashed ident.

E.g.:

```css
.foo {
  --target: --sidebar;
  anchor-name: var(--target);
}
```

A workaround that some people used is adding a `_` in front of the
variable: `mt-[_--my-thing]` this way we don't automatically inject the
`var(…)` around it. This is a workaround and gross.

While the idea of automatic var injection is neat, this causes more
trouble than it's worth. Adding `var(…)` explicitly is better.

A side effect of this is that we can simplify the internals for the
`candidate` data structure because we don't need to track `dashedIdent`
separately anymore.


<!--

👋 Hey, thanks for your interest in contributing to Tailwind!

**Please ask first before starting work on any significant new
features.**

It's never a fun experience to have your pull request declined after
investing a lot of time and effort into a new feature. To avoid this
from happening, we request that contributors create an issue to first
discuss any significant new features. This includes things like adding
new utilities, creating new at-rules, or adding new component examples
to the documentation.


https://github.com/tailwindcss/tailwindcss/blob/master/.github/CONTRIBUTING.md

-->
2024-09-23 21:57:29 +02:00
.github ci: speedup windows integrations tests (#14485) 2024-09-20 15:59:18 -04:00
crates Release v4.0.0-alpha.24 (#14395) 2024-09-12 16:10:56 +02:00
integrations Resolve @import in core (#14446) 2024-09-23 17:05:55 +02:00
packages Remove automatic var(…) injection (#13657) 2024-09-23 21:57:29 +02:00
patches Add standalone CLI (#14270) 2024-09-02 15:23:46 +02:00
playgrounds Postcss: Bring back proper type exports (#14256) 2024-08-26 15:54:07 +02:00
scripts Add GitHub release workflow (#14346) 2024-09-05 09:45:29 -04:00
.gitattributes Add .gitattributes and define a merge strategy for changelog files 2024-08-26 16:27:41 +02:00
.gitignore Add test.debug to integration tests (#14133) 2024-08-08 12:02:19 +02:00
.npmrc introduce v4 codebase 2024-03-05 14:29:15 +01:00
.prettierignore Hoist oxide/crates to just crates (#13333) 2024-03-23 09:00:48 -04:00
Cargo.lock Improve Oxide scanner API (#14187) 2024-08-16 15:05:42 +02:00
Cargo.toml Hoist oxide/crates to just crates (#13333) 2024-03-23 09:00:48 -04:00
CHANGELOG.md Remove automatic var(…) injection (#13657) 2024-09-23 21:57:29 +02:00
LICENSE Add README, LICENSE, and CONTRIBUTING (#13088) 2024-03-05 14:45:39 -05:00
package.json Update turbo 2.0.12 → 2.1.1 (minor) (#14456) 2024-09-23 14:24:09 +02:00
pnpm-lock.yaml Resolve @import in core (#14446) 2024-09-23 17:05:55 +02:00
pnpm-workspace.yaml Bump dependencies (#14160) 2024-08-09 16:12:24 +02:00
README.md Copy README file to every package (#13096) 2024-03-06 08:49:31 -05:00
rust-toolchain.toml Pin rust toolchain to work around Windows regression (#14406) 2024-09-12 14:07:43 +02:00
turbo.json Fix Rust build by passing through RUSTUP_HOME variable (#14171) 2024-08-12 11:37:45 +02:00
vitest.workspace.ts introduce v4 codebase 2024-03-05 14:29:15 +01:00

Tailwind CSS

A utility-first CSS framework for rapidly building custom user interfaces.

Build Status Total Downloads Latest Release License


Documentation

For full documentation, visit tailwindcss.com.

Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Discuss Tailwind CSS on GitHub

For chatting with others using the framework:

Join the Tailwind CSS Discord Server

Contributing

If you're interested in contributing to Tailwind CSS, please read our contributing docs before submitting a pull request.