45 Commits

Author SHA1 Message Date
Robin Malfait
691ed02f63
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
Adam Wathan
476d445629
Fix missing !important when using @apply (#4854)
* Add failing test for #4823

* Fix important variant `@apply`

Co-authored-by: Brad Cornes <bradlc41@gmail.com>
2021-08-27 16:08:25 +02:00
Robin Malfait
baa8f6528b
Ensure nested [] is allowed (#5304)
This will allow us to write something like:

`grid-cols-[[linename],1fr,auto]`
2021-08-26 13:50:39 +02:00
Robin Malfait
fa3d454d06
Ensure arbitrary values only support valid values (#5293)
* ensure arbitrary values only support valid values

* ensure we validate balancing [], () and {}
2021-08-26 05:52:47 -04:00
Brad Cornes
5d0abea336
Fix object-position arbitrary values (#5245) 2021-08-20 22:40:11 -04:00
Brad Cornes
b56b4c0b14
[JIT] Support animation lists (#5252)
* Support animation lists

* Update tests
2021-08-20 22:39:06 -04:00
Brad Cornes
e1160e38ac
Skip escaped commas when splitting selector (#5239) 2021-08-17 20:06:31 -04:00
Brad Cornes
4ff383fbbe
Fix malformed keyframes when using class variants (#5223) 2021-08-16 12:25:30 -04:00
Robin Malfait
bfc9fa79d4
Improve tests (#5108)
* change specific selector to universal selector

This is the commit that we could "undo" in the future if we need it
again.

* simplify `relative-purge-paths` test

This test doesn't require the "reset" selector (whether it is super specific or universal)

Simplified it so that it tests the relative purge config and nothing else.

* added css tagged template literal helpers

This allows prettier to format the string as CSS. This improves formatting and will improve future diffs.

* drop tailwind headers in the sanity tests

Every time we bump the Tailwind version, the sanity tests fail, because
the current version is encoded in the fixture files.

This will ensure that all of the contents is still checked and the
header is skipped. The header will be tested against a regex to ensure
that it is still there.

This should be a small but nice QoL improvement, so that we don't have
to think about updating those tests whenever we fix bugs or land new
features.
2021-07-29 07:31:06 -04:00
Adam Wathan
a76fb7fb14
Fix issue where base styles not generated for translate transforms in JIT (#5038) 2021-07-21 15:42:38 -04:00
Adam Wathan
4a070ac0be
Try to use lowest impact selector when filling in defaults (#4866) 2021-07-01 17:18:46 -04:00
Adam Wathan
fe27356680
JIT: Optimize universal selector usage by inlining only the relevant selectors (#4850)
* WIP

* run prettier

* drop new lines in custom matcher

Drop all newlines, let prettier handle everything for us.

* add cache for the selector parser

* add `@apply` tests for the universal optimizer

* drop comments

* initial replacements

* WIP

* WIP

* MAKE IT WORK

* Rename to resolveDefaultsAtRules

* Update tests + defaults identifiers

* Don't add @defaults in AOT mode

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2021-07-01 06:33:37 -04:00
Adam Wathan
a6e79f9e85
Improve extractor for arbitrary values with quotes (#4817)
Fixes #4801.
2021-06-26 10:20:49 -04:00
Adam Wathan
59c7e32a3b
Ignore "!*" in templates (#4816)
Fixes #4746
2021-06-26 10:20:36 -04:00
Robin Malfait
0413b84c12
ensure peer variants don't include multiple ~ characters (#4757)
Fixes: #4726
2021-06-22 20:40:52 -04:00
Adam Wathan
1d72dc2699
Error when dash is used as custom separator (#4704) 2021-06-18 16:01:38 -04:00
Robin Malfait
f6e36c2847
Fix stacking context issue (#4700)
* add no-op transform, filter, backdrop-filter utilities

* update tests
2021-06-18 16:31:14 +02:00
Brad Cornes
243e8814d8
Resolve purge paths relative to the current working directory (#4655)
* resolve purge paths relative to cwd

* simplify test
2021-06-15 16:37:04 -04:00
Adam Wathan
81816df3a1 Support arbitrary values for object-position 2021-06-14 16:03:14 -04:00
Adam Wathan
546cff81e7
Allow quotes in arbitrary value blocks (#4625) 2021-06-11 09:55:35 -04:00
Adam Wathan
cb2598ce33
Add support for transform, filter, backdrop-filter, box-shadow and ring to pseudo-elements (#4624)
* Add support for transform, filter, backdrop-filter, box-shadow and ring to pseudo-elements

* Rebuild fixtures
2021-06-11 09:11:56 -04:00
Adam Wathan
34d0551e93
Remove need for filter and backdrop-filter toggles (#4611) 2021-06-10 11:36:15 -04:00
Adam Wathan
b86aa5c2a9
Remove need for transform toggle (#4604) 2021-06-10 09:15:41 -04:00
Adam Wathan
b9dd8b0a6d
Add peer variant (#4556) 2021-06-04 10:32:49 -04:00
Robin Malfait
d6b11b3807
Group variant stacking (#4551)
* make group variant stacking work

* simplify stacking group variants
2021-06-03 15:25:46 +02:00
Adam Wathan
7264a5b71b
Generate group parent classes correctly with custom separator (#4508) 2021-05-30 15:02:55 -04:00
Adam Wathan
15642fbcc8 Compare adjacent rules ignoring whitespace 2021-05-30 14:55:30 -04:00
Adam Wathan
77dfac2bfa
JIT: Add caret-color utilities (#4499)
Co-Authored-By: Jesse Katsumata <niconico.clarinet@gmail.com>

Co-authored-by: Jesse Katsumata <niconico.clarinet@gmail.com>
2021-05-28 13:55:42 -04:00
Adam Wathan
d1e9632064
JIT: Add exhaustive pseudo-class and pseudo-element variant support (#4482)
* Add first-line, first-letter, and marker variants

* Add selection variant

Co-Authored-By: Eric Rodrigues Pires <eric@eric.dev.br>

* Add remaining pseudo-class variants

* Add target pseudo-class

Co-Authored-By: Peter Neupauer <peter@neupauer.sk>

* add test for parallel variants

* implement parallel variants

Co-authored-by: Eric Rodrigues Pires <eric@eric.dev.br>
Co-authored-by: Peter Neupauer <peter@neupauer.sk>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2021-05-27 17:09:29 +02:00
Brad Cornes
6bf6738683 Add transform and extract APIs (#4469)
* add `transform` and `extract` APIs

* make svelte transform part of the transformer stuff
2021-05-26 09:43:05 -04:00
Adam Wathan
c8a5f816f4
JIT: Add support for before/after pseudo-elements (#4461) 2021-05-26 08:57:02 -04:00
Adam Wathan
d8bd507b9b
JIT: Add per-side border colors (#4404) 2021-05-20 13:35:39 -04:00
Adam Wathan
23da6b6172
JIT: Replace @tailwind screens with @tailwind variants (#4356)
* Update CHANGELOG

* JIT: Replace `@tailwind screens` with `@tailwind variants`
2021-05-14 13:58:52 -04:00
Adam Wathan
87df93de0a
Support opacity modifiers for colors in JIT (#4348)
* Support opacity modifiers for colors in JIT

* Add test for function colors

* Support opacity modifiers for plugins with arbitrary "any" type
2021-05-14 13:07:56 -04:00
Adam Wathan
30dc2990c3
Error when @layer used without matching @tailwind directive (#4335)
Also refactor to only detect `@tailwind` directives once per build to improve performance.
2021-05-12 16:58:03 -04:00
Adam Wathan
6d51f9a08a Add read-only variant to JIT 2021-05-11 15:36:18 -04:00
Adam Wathan
4bfa21f756
Support border-opacity with default border color (#4277)
* Move border reset to borderColor plugin, support opacity

* Update JIT tests

* Don't use opacity variable for default border color when borderOpacity is disabled

* Fix tests
2021-05-08 06:59:14 -04:00
Adam Wathan
a22398cbdb Add empty variant support to JIT 2021-05-07 14:48:41 -04:00
Brad Cornes
477dd06ec3
Resolve purge paths (#4214)
* resolve purge paths

* add test for purgecss pattern resolution

* resolve purgecss patterns relative to the config file if there is one

* account for raw content when transforming purgecss options

* append test name to postcss `from` option in purge tests
fixes tests hanging

* add test for relative purge path resolution in JIT mode
2021-05-07 13:46:19 -04:00
Adam Wathan
e764df5055
Support forcing coercion type with arbitrary value syntax (#4263)
* Support forcing coercion type with arbitrary value syntax

* Refactor + more tests
2021-05-07 08:59:24 -04:00
Brad Cornes
4a374ebe5e
[JIT] Add support for "raw" purge content (#4272)
* add support for "raw" purge content

* add support for raw content extensions
2021-05-07 08:58:58 -04:00
Adam Wathan
33fbad9ad6
Support applying important utilities in JIT (#4260) 2021-05-06 13:52:26 -04:00
Robin Malfait
6628eb00ca
Improve matchUtilities API and make it work with the AOT engine (#4232)
* implement matchUtilities2

* ensure animation names without keyframes are not prefixed

* remove matchBase

* call addUtilities for each group individually

* WIP: Write plugins using matchUtilities2

* MORE

* Fix arbitrary value support for fontSize

* Fixes, update fixtures

* Rebuild fixtures

* Don't generate `divide` class with no modifier

* Fixes, rebuild fixtures

* Rename matchUtilities2 to matchUtilities

* Delete bad tests

* Remove temp files GROSS

* Clean stuff up

* Support no return in matchUtilities

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-05-05 15:23:32 +02:00
Adam Wathan
1a1fc1c5c6 Refactor fontVariantNumeric to remove mode condition 2021-04-30 12:04:23 -04:00
Robin Malfait
bfc61625d9
[WIP] Unify JIT and AOT code paths (#4188)
* WIP

* WIP

* Finish combining JIT and AOT plugins

Still lots of clean up that can be done in some of the more complex ones, but at least it's one file per plugin now.

* Remove unused import

* Fix AOT generation bugs

* Move corePlugins/index.js to corePlugins.js

* Convert JIT files to ESM

* Move tests

* Reorder core plugins to match JIT order

* Update AOT apply tests

* Unify utils

* Combine plugin lists to one single source of truth

* Finish resolving merge conflicts, fix tests

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-04-30 10:58:40 -04:00