2023-01-20 12:45:04 -05:00
|
|
|
import { crosscheck, run, html, css } from '../util/run'
|
Remove AOT (#5340)
* make `jit` mode the default when no mode is specified
* unify JIT and AOT codepaths
* ensure `Object.entries` on undefined doesn't break
It could be that sometimes you don't have values in your config (e.g.: `presets: []`), this in turn will break some plugins where we assume we have a value.
* drop AOT specific tests
These tests are all covered by JIT mode already and were AOT specific.
* simplify tests, and add a few
Some of the tests were written for AOT specifically, some were missing. We also updated the way we write those tests, essentially making Tailwind a blackbox, by testing against the final output.
Now that JIT mode is the default, this is super fast because we only generate what is used, instead of partially testing in a 3MB file or building it all, then purging.
* add some todo's to make sure we warn in a few cases
* make `darkMode: 'media'`, the default
This also includes moving dark mode tests to its own dedicated file.
* remove PostCSS 7 compat mode
* update CLI to be JIT-first
* fix integration tests
This is not a _real_ fix, but it does solve the broken test for now.
* warn when using @responsive or @variants
* remove the JIT preview warning
* remove AOT-only code paths
* remove all `mode: 'jit'` blocks
Also remove `variants: {}` since they are not useful in `JIT` mode
anymore.
* drop unused dependencies
* rename `purge` to `content`
* remove static CDN builds
* mark `--purge` as deprecated in the CLI
This will still work, but a warning will be printed and it won't show up
in the `--help` output.
* cleanup nesting plugin
We don't have to duplicate it anymore since there is no PostCSS 7
version anymore.
* make sure integration tests run in band
* cleanup folder structure
* make sure nesting folder is available
* simplify resolving of purge/content information
2021-09-01 17:13:59 +02:00
|
|
|
|
2023-02-17 20:21:22 +01:00
|
|
|
crosscheck(({ stable, oxide }) => {
|
2023-01-20 12:45:04 -05:00
|
|
|
test('opacity variables are given to colors defined as closures', () => {
|
|
|
|
|
let config = {
|
|
|
|
|
content: [
|
|
|
|
|
{
|
|
|
|
|
raw: html`<div
|
|
|
|
|
class="text-primary text-secondary from-primary from-secondary via-primary via-secondary to-primary to-secondary text-opacity-50"
|
|
|
|
|
></div>`,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
theme: {
|
|
|
|
|
colors: {
|
|
|
|
|
primary: ({ opacityVariable, opacityValue }) => {
|
|
|
|
|
if (opacityValue !== undefined) {
|
|
|
|
|
return `rgba(31,31,31,${opacityValue})`
|
|
|
|
|
}
|
2020-08-19 11:38:22 -04:00
|
|
|
|
2023-01-20 12:45:04 -05:00
|
|
|
if (opacityVariable !== undefined) {
|
|
|
|
|
return `rgba(31,31,31,var(${opacityVariable},1))`
|
|
|
|
|
}
|
2020-08-19 11:38:22 -04:00
|
|
|
|
2023-01-20 12:45:04 -05:00
|
|
|
return `rgb(31,31,31)`
|
|
|
|
|
},
|
|
|
|
|
secondary: 'hsl(10, 50%, 50%)',
|
|
|
|
|
},
|
|
|
|
|
opacity: {
|
|
|
|
|
50: '0.5',
|
2020-08-18 23:26:29 +02:00
|
|
|
},
|
|
|
|
|
},
|
2023-01-20 12:45:04 -05:00
|
|
|
}
|
2021-04-30 15:09:58 +02:00
|
|
|
|
2023-01-20 12:45:04 -05:00
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
2023-02-17 20:21:22 +01:00
|
|
|
stable.expect(result.css).toMatchFormattedCss(css`
|
2023-01-20 12:45:04 -05:00
|
|
|
.from-primary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-from: #1f1f1f var(--tw-gradient-from-position);
|
2023-04-13 22:12:12 +02:00
|
|
|
--tw-gradient-to: #1f1f1f00 var(--tw-gradient-to-position);
|
2023-01-20 12:45:04 -05:00
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
|
|
|
}
|
|
|
|
|
.from-secondary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-from: #bf5540 var(--tw-gradient-from-position);
|
2023-04-13 22:12:12 +02:00
|
|
|
--tw-gradient-to: #bf554000 var(--tw-gradient-to-position);
|
2023-01-20 12:45:04 -05:00
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
|
|
|
}
|
|
|
|
|
.via-primary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-to: #1f1f1f00 var(--tw-gradient-to-position);
|
|
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), #1f1f1f var(--tw-gradient-via-position),
|
|
|
|
|
var(--tw-gradient-to);
|
2023-01-20 12:45:04 -05:00
|
|
|
}
|
|
|
|
|
.via-secondary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-to: #bf554000 var(--tw-gradient-to-position);
|
|
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), #bf5540 var(--tw-gradient-via-position),
|
|
|
|
|
var(--tw-gradient-to);
|
2023-01-20 12:45:04 -05:00
|
|
|
}
|
|
|
|
|
.to-primary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-to: #1f1f1f var(--tw-gradient-to-position);
|
2023-01-20 12:45:04 -05:00
|
|
|
}
|
|
|
|
|
.to-secondary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-to: #bf5540 var(--tw-gradient-to-position);
|
2023-01-20 12:45:04 -05:00
|
|
|
}
|
|
|
|
|
.text-primary {
|
|
|
|
|
--tw-text-opacity: 1;
|
|
|
|
|
color: rgba(31, 31, 31, var(--tw-text-opacity));
|
|
|
|
|
}
|
|
|
|
|
.text-secondary {
|
|
|
|
|
--tw-text-opacity: 1;
|
|
|
|
|
color: hsl(10 50% 50% / var(--tw-text-opacity));
|
|
|
|
|
}
|
|
|
|
|
.text-opacity-50 {
|
|
|
|
|
--tw-text-opacity: 0.5;
|
|
|
|
|
}
|
|
|
|
|
`)
|
2023-02-17 20:21:22 +01:00
|
|
|
oxide.expect(result.css).toMatchFormattedCss(css`
|
|
|
|
|
.from-primary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-from: #1f1f1f var(--tw-gradient-from-position);
|
2023-04-13 22:12:12 +02:00
|
|
|
--tw-gradient-to: #1f1f1f00 var(--tw-gradient-to-position);
|
2023-02-17 20:21:22 +01:00
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
|
|
|
}
|
|
|
|
|
.from-secondary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-from: #bf5540 var(--tw-gradient-from-position);
|
2023-04-13 22:12:12 +02:00
|
|
|
--tw-gradient-to: #bf554000 var(--tw-gradient-to-position);
|
2023-02-17 20:21:22 +01:00
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
|
|
|
}
|
|
|
|
|
.via-primary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-to: #1f1f1f00 var(--tw-gradient-to-position);
|
|
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), #1f1f1f var(--tw-gradient-via-position),
|
|
|
|
|
var(--tw-gradient-to);
|
2023-02-17 20:21:22 +01:00
|
|
|
}
|
|
|
|
|
.via-secondary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-to: #bf554000 var(--tw-gradient-to-position);
|
|
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), #bf5540 var(--tw-gradient-via-position),
|
|
|
|
|
var(--tw-gradient-to);
|
2023-02-17 20:21:22 +01:00
|
|
|
}
|
|
|
|
|
.to-primary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-to: #1f1f1f var(--tw-gradient-to-position);
|
2023-02-17 20:21:22 +01:00
|
|
|
}
|
|
|
|
|
.to-secondary {
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-to: #bf5540 var(--tw-gradient-to-position);
|
2023-02-17 20:21:22 +01:00
|
|
|
}
|
|
|
|
|
.text-primary {
|
|
|
|
|
color: #1f1f1f;
|
|
|
|
|
}
|
|
|
|
|
.text-secondary {
|
|
|
|
|
color: #bf5540;
|
|
|
|
|
}
|
|
|
|
|
`)
|
2023-01-20 12:45:04 -05:00
|
|
|
})
|
Remove AOT (#5340)
* make `jit` mode the default when no mode is specified
* unify JIT and AOT codepaths
* ensure `Object.entries` on undefined doesn't break
It could be that sometimes you don't have values in your config (e.g.: `presets: []`), this in turn will break some plugins where we assume we have a value.
* drop AOT specific tests
These tests are all covered by JIT mode already and were AOT specific.
* simplify tests, and add a few
Some of the tests were written for AOT specifically, some were missing. We also updated the way we write those tests, essentially making Tailwind a blackbox, by testing against the final output.
Now that JIT mode is the default, this is super fast because we only generate what is used, instead of partially testing in a 3MB file or building it all, then purging.
* add some todo's to make sure we warn in a few cases
* make `darkMode: 'media'`, the default
This also includes moving dark mode tests to its own dedicated file.
* remove PostCSS 7 compat mode
* update CLI to be JIT-first
* fix integration tests
This is not a _real_ fix, but it does solve the broken test for now.
* warn when using @responsive or @variants
* remove the JIT preview warning
* remove AOT-only code paths
* remove all `mode: 'jit'` blocks
Also remove `variants: {}` since they are not useful in `JIT` mode
anymore.
* drop unused dependencies
* rename `purge` to `content`
* remove static CDN builds
* mark `--purge` as deprecated in the CLI
This will still work, but a warning will be printed and it won't show up
in the `--help` output.
* cleanup nesting plugin
We don't have to duplicate it anymore since there is no PostCSS 7
version anymore.
* make sure integration tests run in band
* cleanup folder structure
* make sure nesting folder is available
* simplify resolving of purge/content information
2021-09-01 17:13:59 +02:00
|
|
|
})
|
2023-03-28 15:38:30 +02:00
|
|
|
|
|
|
|
|
test('gradient color stop position', () => {
|
|
|
|
|
let config = {
|
|
|
|
|
content: [
|
|
|
|
|
{
|
|
|
|
|
raw: html`
|
|
|
|
|
<div>
|
|
|
|
|
<div
|
|
|
|
|
class="bg-gradient-to-r from-red-500 from-50 via-pink-500 via-75 to-violet-400 to-80"
|
|
|
|
|
></div>
|
|
|
|
|
<div class="from-10% from-[11%] from-[12px] from-[--from-value]"></div>
|
|
|
|
|
<div class="via-20% via-[12%] via-[123px] via-[--via-value]"></div>
|
|
|
|
|
<div class="to-30% to-[13%] to-[14px] to-[--to-value]"></div>
|
|
|
|
|
</div>
|
|
|
|
|
`,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
theme: {},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return run('@tailwind utilities', config).then((result) => {
|
|
|
|
|
expect(result.css).toMatchFormattedCss(css`
|
|
|
|
|
.bg-gradient-to-r {
|
|
|
|
|
background-image: linear-gradient(to right, var(--tw-gradient-stops));
|
|
|
|
|
}
|
|
|
|
|
.from-\[--from-value\] {
|
|
|
|
|
--tw-gradient-from: var(--from-value) var(--tw-gradient-from-position);
|
2023-04-13 22:12:12 +02:00
|
|
|
--tw-gradient-to: #fff0 var(--tw-gradient-to-position);
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
|
|
|
}
|
|
|
|
|
.from-red-500 {
|
|
|
|
|
--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);
|
2023-04-13 22:12:12 +02:00
|
|
|
--tw-gradient-to: #ef444400 var(--tw-gradient-to-position);
|
2023-03-28 15:38:30 +02:00
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
|
|
|
}
|
|
|
|
|
.from-10\% {
|
|
|
|
|
--tw-gradient-from-position: 10%;
|
|
|
|
|
}
|
|
|
|
|
.from-\[11\%\] {
|
|
|
|
|
--tw-gradient-from-position: 11%;
|
|
|
|
|
}
|
|
|
|
|
.from-\[12px\] {
|
|
|
|
|
--tw-gradient-from-position: 12px;
|
|
|
|
|
}
|
|
|
|
|
.via-\[--via-value\] {
|
|
|
|
|
--tw-gradient-to: #fff0 var(--tw-gradient-to-position);
|
|
|
|
|
--tw-gradient-stops: var(--tw-gradient-from),
|
|
|
|
|
var(--via-value) var(--tw-gradient-via-position), var(--tw-gradient-to);
|
|
|
|
|
}
|
|
|
|
|
.via-pink-500 {
|
|
|
|
|
--tw-gradient-to: #ec489900 var(--tw-gradient-to-position);
|
|
|
|
|
--tw-gradient-stops: var(--tw-gradient-from), #ec4899 var(--tw-gradient-via-position),
|
|
|
|
|
var(--tw-gradient-to);
|
|
|
|
|
}
|
|
|
|
|
.via-20\% {
|
|
|
|
|
--tw-gradient-via-position: 20%;
|
|
|
|
|
}
|
|
|
|
|
.via-\[12\%\] {
|
|
|
|
|
--tw-gradient-via-position: 12%;
|
|
|
|
|
}
|
|
|
|
|
.via-\[123px\] {
|
|
|
|
|
--tw-gradient-via-position: 123px;
|
|
|
|
|
}
|
|
|
|
|
.to-\[--to-value\] {
|
|
|
|
|
--tw-gradient-to: var(--to-value) var(--tw-gradient-to-position);
|
|
|
|
|
}
|
|
|
|
|
.to-violet-400 {
|
|
|
|
|
--tw-gradient-to: #a78bfa var(--tw-gradient-to-position);
|
|
|
|
|
}
|
|
|
|
|
.to-30\% {
|
|
|
|
|
--tw-gradient-to-position: 30%;
|
|
|
|
|
}
|
|
|
|
|
.to-\[13\%\] {
|
|
|
|
|
--tw-gradient-to-position: 13%;
|
|
|
|
|
}
|
|
|
|
|
.to-\[14px\] {
|
|
|
|
|
--tw-gradient-to-position: 14px;
|
|
|
|
|
}
|
|
|
|
|
`)
|
|
|
|
|
})
|
|
|
|
|
})
|
2020-08-18 23:26:29 +02:00
|
|
|
})
|