Skip to content

Commit 2cd26db

Browse files
committed
Document colorMixPolyfill in the package README; assert the @supports wrapper in the default-arm test
1 parent b92b9f7 commit 2cd26db

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/@tailwindcss-postcss/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,25 @@ export default {
8888
}
8989
```
9090

91+
### Enabling or disabling the `color-mix(…)` polyfill
92+
93+
For browsers without `color-mix()` support (Safari < 16.2), the plugin emits every `color-mix(…)` declaration twice: a plain fallback declaration, plus the original gated behind `@supports (color: color-mix(in lab, red, red))`. This is enabled by default.
94+
95+
If every browser you support has `color-mix()`, you can set `colorMixPolyfill` to `false` to drop the duplicated declarations from the output:
96+
97+
```js
98+
import tailwindcss from '@tailwindcss/postcss'
99+
100+
export default {
101+
plugins: [
102+
tailwindcss({
103+
// Disable the `color-mix(…)` fallbacks
104+
colorMixPolyfill: false,
105+
}),
106+
],
107+
}
108+
```
109+
91110
### Enabling or disabling `url(…)` rewriting
92111

93112
Our PostCSS plugin can rewrite `url(…)`s for you since it also handles `@import` (no `postcss-import` is needed). This feature is enabled by default.

packages/@tailwindcss-postcss/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ test('`color-mix(…)` fallbacks can be disabled', async () => {
111111
let withPolyfill = await postcss([
112112
tailwindcss({ base: `${__dirname}/fixtures/example-project`, optimize: { minify: false } }),
113113
]).process(input, { from: inputCssFilePath() })
114-
expect(withPolyfill.css).toContain('color-mix(in lab, red, red)')
114+
expect(withPolyfill.css).toContain('@supports (color: color-mix(in lab, red, red))')
115115

116116
// Disabled: the declaration ships once, and nothing else changes.
117117
let withoutPolyfill = await postcss([

0 commit comments

Comments
 (0)