5324 Commits

Author SHA1 Message Date
Jordan Pittman
82b5c8d0c0 Fix date 2025-11-28 06:37:56 -05:00
Jordan Pittman
e2b47e8a5e
v3: Don’t break sibling-*() functions when used inside calc(…) (#19335)
The implementation of v3's math operator normalization uses a safe-list
of function names. Need to add `sibling-index()` and `sibling-count()`
to this list otherwise when used inside math functions like `calc()`
they'll get spaces around the `-`.
2025-11-19 10:35:48 -05:00
Robin Malfait
7e2dd5383a
Never publish v3 as latest on npm (#19043)
This PR ensures that if we release v3 in the future, that we don't use
`latest` as the npm tag, but `v3-lts` instead.

Unfortunately we can't just use `3` or `v3` because they are not valid
and you will get an error when trying to publish.

Angular uses `v{n}-lts` for the versions they still support:
https://www.npmjs.com/package/@angular/core?activeTab=versions

Adding a tag is important, because omitting the `--tag` is the same as
`--tag latest`
2025-10-01 18:25:46 +02:00
Jordan Pittman
536e38ff18 Don’t tag v3.4 releases as latest
oops
2025-10-01 11:47:08 -04:00
Jordan Pittman
229b1984dc
v3: Bundle postcss-load-config v4 with the standalone CLI (#19042)
Unfortunately, it’s not possible to intercept the `await import(…)` used
by newer versions. This means the Standalone CLI will not be able to
load ESM postcss config files. You still will using the npm package and
newer versions of Node.js.
v3.4.18
2025-10-01 11:18:15 -04:00
Jordan Pittman
11de06fd9d
Prepare v3.4.18 release (#19038) 2025-10-01 09:45:30 -04:00
Jordan Pittman
aecc8521dc
v3: Remove irrelevant utility rules when matching important classes (#19030)
Fixes #18678

When given a simple plugin like this:
```js
export default {
  content: [{ raw: '!a' },],
  plugins: [
    ({ addBase }) => addBase({
      '@media (min-width: 1728px)': {
        '.a': { 'padding-top': '1rem !important' },
        '.b': { 'padding-right': '1rem !important' },
      }
    }),
  ],
}
```

If this plugin saw the utility `!a` it would correctly modify both rules
to eliminate any irrelevant classes. Unfortunately, in the case of the
2nd rule this meant it's left with an empty selector which is invalid.

We now detect this case and remove the rule if that happens.
2025-09-29 18:11:09 -04:00
Jordan Pittman
ba55a445cd
Fix native ESM config loading in v3 (#18938)
Unfortunately for backwards compatibility purposes (with `loadConfig` at
least) we can't switch things to use `import(…)` because there's baked
in knowledge that the config is loaded synchronously for v3.

This PR does two things:
- Defers to `require(…)` which allows newer versions that support
`require(esm)` to work natively. This works around the need to switch to
`import(…)` for those versions.
- Allows newer versions of `postcss-load-config` enabling better
ESM+TypeScript support for PostCSS configs in the CLI.

We support v4, v5, and v6 of `postcss-load-config` simultaneously so any
of those versions should work. I've verified that newer node versions
seem to install v6 while earlier ones like Node v14 install v4 of
`postcss-load-config`. So this should be a backwards compatible change.

- [x] needs tests for `import.meta.resolve(…)`
- [x] needs tests for ESM postcss configs

Fixes #14152
Fixes #14423
2025-09-16 14:03:09 -04:00
Philippe Gaultier
ff52f8caf2
Fix require.cache error when loaded through a typescript file in Node 22.18+ (#18665)
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2025-08-22 12:44:51 -04:00
Brandon McConnell
40f506f317
v3: Allow hyphen character in regex pattern to use support queries as is (#13605)
This is the v3 equivalent of PR #13596

Matching for the hyphen character in the existing regex to use support
queries as-is

Resolves #13594

Tests (w/ updated):
-  `supports-[display:grid]:grid`
-  `supports-[transform-origin:5%_5%]:underline`
-  `supports-[not(foo:bar)]:underline`
-  `supports-[(foo:bar)or(bar:baz)]:underline`
-  `supports-[(foo:bar)and(bar:baz)]:underline`
-  `supports-[(foo:bar)_and_(bar:baz)]:grid`
-  `supports-[(foo:bar)_and_(bar:baz)_or(baz:qux)]:grid`
-  `supports-[container-type]:underline`
-  `supports-grid:underline`
-  `supports-[--test]:flex`
-  `supports-[selector(A_>_B)]:underline`
-  `supports-[font-format(opentype)]:grid`
-  `supports-[font-tech(color-COLRv1)]:flex`

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-01-28 17:42:09 +01:00
Jordan Pittman
4f9f603e12 Fix error v3.4.17 2024-12-17 14:07:10 -05:00
Jordan Pittman
02faa1529e v3.4.17 2024-12-17 13:46:50 -05:00
Jordan Pittman
e268b2aa96 Update changelog 2024-12-17 13:45:39 -05:00
Jordan Pittman
0a836f76bb
Work around issue with Node 22 and Jiti (#15421)
Fixes #15374

If we always use Jiti the problem should, in theory, go away (I hope).
It does mean that loading configs is slower than it would be if they're
written in CJS but 🤷‍♂️

Wanna get this running with the integration tests to see if anything
breaks.
2024-12-17 13:43:33 -05:00
Jordan Pittman
f875ab9706 Bump macos version v3.4.16 2024-12-03 14:25:44 -05:00
Jordan Pittman
8f91c27d3e v3.4.16 2024-12-03 14:22:00 -05:00
Andrew Powell
8c8c986e09
fix: update lilconfig for ESM and Windows support (#15289)
This PR updates `lilconfig` from v2.1.0 to v3.1.3. Significant
improvements to this package include Windows absolute path support as
well as ESM config files support. This supersedes
https://github.com/tailwindlabs/tailwindcss/pull/14029 which has fallen
behind and has conflicts with the upstream branch. This is a critical
update for Next.js apps running in development which have dependencies
on packages that use an updated version of `lilconfig`. I understand
that v4 will not be using `lilconfig` but it's an important update for
users on v3.x in the meantime.

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-12-03 14:19:29 -05:00
Brody McKee
2702cfcc2c
Fix Plugin type issue (#14668)
This is a quick fix to an issue where the types for PluginsConfig don't
match those used in plugins like
[`@tailwindcss/container-queries`](https://github.com/tailwindlabs/tailwindcss-container-queries).

This was caught by TypeScript with [`exactOptionalPropertyTypes`](
https://www.typescriptlang.org/tsconfig/exactOptionalPropertyTypes.html)
enabled, where TypeScript checks if `undefined` can be supplied as a
value for optional types.

I felt that it made more sense to fix this here, as it makes the core
types more flexible, as opposed to each plugin needing to fix this
when/if they hit it.

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2024-11-28 11:12:08 +01:00
Jordan Pittman
6069a81187 v3.4.15 v3.4.15 2024-11-14 13:35:09 -05:00
Jordan Pittman
d093dce0fb
Add variable fallback to fix Chrome issue (#15003)
This works around an issue in Chrome where `::selection` does not read
from variables defined on `::selection` thus breaking all uses of color
utilities with the selection variant. e.g. `selection::bg-red-200`.

We now add a fallback value of `1` to all uses of
`var(--tw-bg-opacity)`, `var(--tw-text-opacity)`,
`var(--tw-border-opacity)`, etc… since Chrome treats the variable as if
it did not exist because it's not defined on the parent.

In Chrome 131 (until the change is rolled back) existing utilities like
these will not work:
- `selection:text-opacity-50`
- `selection:[--tw-text-opacity:0.5]`

Fixes #15000

---------

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2024-11-14 13:33:27 -05:00
Bart Nagel
4de07697bd
Fix config types for boxShadow (#14856)
`boxShadow` accepts multiple shadows just like `dropShadow` does. This
patch fixes the TS typings to reflect that.

See demo showing that multiple shadows are supported (complete with it
incorrectly complaining that the config is bad) here:
https://play.tailwindcss.com/VHqWbbEIrz?file=config

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2024-11-07 12:22:05 +01:00
Robin Malfait
8b41e82621
update changelog 2024-10-17 18:53:10 +02:00
Robin Malfait
825cd83cca
Add CODEOWNERS file (#14702)
This PR adds a new `CODEOWNERS` file so that the
`@tailwindlabs/engineering` will be automatically requested for review
when changes are made to the repository.
2024-10-17 09:06:05 -04:00
Robin Malfait
c8c3a22442
Bump dependencies to fix vulnerabilities (#14697)
This PR fixes some package vulnerabilities that you will see when
running `npm install`. This PR fixes that by bumping dependencies to get
rid of the vulnerabilities.
2024-10-17 06:41:15 -04:00
Robin Malfait
c616fb9562
3.4.14 v3.4.14 2024-10-15 12:29:17 +02:00
Adam Wathan
b570e2b887
Don't set display: none on elements that use hidden="until-found" (#14625)
Fixes an issue reported by the React Aria Components team here:

https://github.com/adobe/react-spectrum/issues/7160

Basically `hidden="until-found"` behaves very differently than `hidden`
and doesn't actually use `display: none`, so we don't want to apply the
behavior we apply for the regular `hidden` attribute.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-10-09 13:55:48 +02:00
Robin Malfait
ed3c5356b7
3.4.13 v3.4.13 2024-09-23 16:56:58 +02:00
ivan
066ccf8894
Improve the performance when checking broad glob patterns. (#14481)
In a large project, it's costly to repeatedly call the
function `micromatch.isMatch` that parses a glob pattern,
creates a regular expression, and tests the path name
against the regular expression. To optimize performance,
it's important to cache the parsing and creating process
before entering the loop.

For example, the content configuration in a project
looks like this
`['./pages/**/*.{ts,js}', './node_modules/pages/**/*.{ts,js}']`.
If the project has 10000 matched files and 10 glob patterns,
the function `micromatch.isMatch` will be called 100000 times.

---

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-09-23 10:52:05 +02:00
Robin Malfait
e8614a268d
3.4.12 v3.4.12 2024-09-17 15:13:09 +02:00
Adam Wathan
fe48ca83d8
Insert @defaults at start of stylesheet (#14427)
Prior to this PR, we'd put all of the `@defaults` (the CSS variables and
stuff) _after_ the `base` rules. This creates an issue when using
`optimizeUniversalDefaults` with CSS that looks like this:

```css
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  input {
    @apply shadow;
  }
}
```

…because the default shadow stuff ends up after the base `input` rules,
so the generated styles are like this:

```css
input {
  --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color),
    0 1px 2px -1px var(--tw-shadow-color);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000),
    var(--tw-shadow);
}

input {
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
  --tw-shadow: 0 0 #0000;
  --tw-shadow-colored: 0 0 #0000;
}
```

This means all of the actual shadow values for the input are reset and
the shadow doesn't work.

Fixes https://github.com/tailwindlabs/tailwindcss/issues/14426.

Lots of failing tests right because this changes a ton of stuff, albeit
in a totally inconsequential way. @thecrypticace if you could update
these for me this week that would be a huge help, just banging this fix
out quick while the kids are napping 😴

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-09-17 09:09:08 -04:00
Robin Malfait
818d10ab84
3.4.11 v3.4.11 2024-09-11 19:25:41 +02:00
Robin Malfait
8dd9246a87
update changelog 2024-09-11 19:25:13 +02:00
Robin Malfait
6d9ae82ba3
Allow anchor-size(…) in arbitrary values (#14393)
This PR fixes an issue where using `anchor-size` in arbitrary values
resulted in the incorrect css.

Input: `w-[calc(anchor-size(width)+8px)]`
Output:
```css
.w-\[calc\(anchor-size\(width\)\+8px\)\] {
  width: calc(anchor - size(width) + 8px);
}
```

This PR fixes that, by generating the correct CSS:
```css
.w-\[calc\(anchor-size\(width\)\+8px\)\] {
  width: calc(anchor-size(width) + 8px);
}
```
2024-09-11 19:23:53 +02:00
Jordan Pittman
f07dbff2a7 3.4.10 v3.4.10 2024-08-13 16:24:27 -04:00
Jordan Pittman
c4f23621e1
Bump versions of plugins in the Standalone CLI (#14185)
This PR updates the plugins built into the standalone CLI. The bundled
versions here are several versions behind (whoops).
2024-08-13 16:16:49 -04:00
Robin Malfait
f65023efb9
3.4.9 v3.4.9 2024-08-08 15:10:38 +02:00
Philipp Spiess
702ba6aaee
Don't warn about broad globs in vendor folders (#14147)
After shipping the new warning that prevents unexpected scanning of all
dependencies in 3.4.8, we noticed that it was firing more often than we
wanted to.

The heuristics we added works by finding broad glob patterns (once that
contain `/**/`) and when those are found and are the _sole pattern used
to match a file of a known-large directory_, we were showing the
warning. The motivation for this is that we have seen time and time
again that an incorrect config like `/**/*.js` can cause recursive scans
through _all_ dependencies including many minified libraries which
greatly impacts performance.

In #14140, we were adding two known-large directory names: 

- `node_modules` (used by npm)
- `vendor` (used by PHP)

The problem with the `vendor` name though is that it is more generic
than we would like it and there are legit use cases to have a folder
named `vendor` inside your component folder. Additionally, PHP vendors
behave a bit differently and it's not super common to have minified
build files in that folder (which is one of the main reasons for the
slow builds). Because of this, we decided to revert the change for
`vendor` and only scan for `node_modules` going forward.
2024-08-08 15:05:52 +02:00
Robin Malfait
1676118af9
3.4.8 v3.4.8 2024-08-07 17:26:53 +02:00
Robin Malfait
69c81f2583
rename master to main 2024-08-07 17:18:38 +02:00
Robin Malfait
858696a8bc
Warn when broad glob patterns are used in the content configuration (#14140)
When you use a glob pattern in your `content` configuration that is too
broad, it could be that you are accidentally including files that you
didn't intend to include. E.g.: all of `node_modules`

This has been documented in the [Tailwind CSS
documentation](https://tailwindcss.com/docs/content-configuration#pattern-recommendations),
but it's still something that a lot of people run into.

This PR will try to detect those patterns and show a big warning to let
you know if you may have done something wrong.

We will show a warning if all of these conditions are true:

1. We detect `**` in the glob pattern
2. _and_ you didn't explicitly use `node_modules` in the glob pattern
3. _and_ we found files that include `node_modules` in the file path
4. _and_ no other globs exist that explicitly match the found file

With these rules in place, the DX has nice trade-offs:

1. Very simple projects (that don't even have a `node_modules` folder),
can simply use `./**/*` because while resolving actual files we won't
see files from `node_modules` and thus won't warn.
2. If you use `./src/**` and you do have a `node_modules`, then we also
won't complain (unless you have a `node_modules` folder in the `./src`
folder).
3. If you work with a 3rd party library that you want to make changes
to. Using an explicit match like `./node_modules/my-package/**/*` is
allowed because `node_modules` is explicitly mentioned.

Note: this only shows a warning, it does not stop the process entirely.
The warning will be show when the very first file in the `node_modules`
is detected.

<!--

👋 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

-->

---------

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2024-08-07 16:55:20 +02:00
Jordan Pittman
1f23c2e842
Bump to latest cssnano v6 (#14105)
We bundle cssnano in our CLI and it's on an older version that does not
handle nested CSS correctly. This PR updates it to the latest version of
v6.x

Fixes #14092
2024-08-02 08:57:14 -04:00
Jordan Pittman
28bd90eefb
Automate checksum generation for standalone CLI (#14081) 2024-08-01 10:02:25 -04:00
Adam Wathan
9824cb64a0 Update version in package.json v3.4.7 2024-07-25 09:20:52 -04:00
Adam Wathan
aa6c10f67f Add missing heading to changelog 2024-07-25 09:16:26 -04:00
Adam Wathan
245058c7fd Update changelog for v3.4.7 2024-07-25 09:06:56 -04:00
Philipp Spiess
605d8cd5eb
Update CHANGELOG.md 2024-07-25 10:13:56 +02:00
Philipp Spiess
680c55c11c
Normalize attribute selector for data-* and aria-* modifiers (#14037)
Fixes #14026 
See #14040 for the v4 fix

When translating `data-` and `aria-` modifiers with attribute selectors,
we currently do not wrap the target attribute in quotes. This only works
for keywords (purely alphabetic words) but breaks as soon as there are
numbers or things like spaces in the attribute:

```html
<div data-id="foo" class="data-[id=foo]:underline">underlined</div>
<div data-id="f1" class="data-[id=1]:underline">not underlined</div>
<div data-id="foo bar" class="data-[id=foo_bar]:underline">not underlined</div>
```

Since it's fairly common to have attribute selectors with `data-` and
`aria-` modifiers, this PR will now wrap the attribute in quotes unless
these are already wrapped.

| Tailwind Modifier  | CSS Selector |
| ------------- | ------------- |
| `.data-[id=foo]`  | `[data-id='foo']`  |
| `.data-[id='foo']`  | `[data-id='foo']`  |
| `.data-[id=foo_i]`  | `[data-id='foo i']`  |
| `.data-[id='foo'_i]`  | `[data-id='foo' i]`  |
| `.data-[id=123]`  | `[data-id='123']`  |

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-07-24 18:46:21 +02:00
Philipp Spiess
866860e6a6
Print eventual lightning CSS parsing errors when the CSS matcher fail (#14034) 2024-07-23 14:40:11 +02:00
Jordan Pittman
bdc87ae1d7
Fix class detection in Slim templates with attached attributes and IDs (#14019)
* Fix class detection in Slim templates with attached attributes and IDs

* Update changelog

* Tweak regex
2024-07-18 11:21:20 -04:00
Jordan Pittman
d622977b2a Update changelog v3.4.6 2024-07-16 10:52:51 -04:00