102 Commits

Author SHA1 Message Date
Adam Wathan
b0cf6eded3
Support using functions as colors when disabling color opacity utilities (#5470) 2021-09-10 09:35:15 -04:00
Robin Malfait
50b766dd47
Remove variants related code (#5465)
* drop `variants` related resolveConfig functionality

More AOT code that we could get rid of!

* drop more files!

I keep finding these unused files 😅

* Update setupContextUtils.js

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-09-10 09:34:27 -04:00
Robin Malfait
9daebe43b9
Replace underscore with space in arbitrary values (#5460)
* refactor dropShadow plugin, use `matchUtilities`

* replace `_` with ` ` for arbitrary values

* remove custom `asList` function

* do not replace escaped underscores with spaces
2021-09-09 18:10:04 +02:00
Brad Cornes
4919cbfbb8
Update color parsing and formatting (#5442)
* Replace `culori` with simple color parser

* Use space-separated color syntax

* Update default color values to use space-separated syntax

* Update separator regex

* Fix tests

* add tests for the new `color` util

Also slightly modified the `color` util itself to take `transparent`
into account and also format every value as a string for consistency.

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2021-09-09 16:15:53 +02:00
Jonathan Reinink
12fa78b9ca
Add column utilities (#5457)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-Authored-By: Cody <codytooker@gmail.com>
2021-09-09 09:29:44 -04:00
Robin Malfait
249f6ff596
drop unused files (#5453) 2021-09-09 08:39:14 +02:00
Jonathan Reinink
1c10cf261b
Add text-indent utilities (#5449)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-08 15:16:46 -04:00
Jonathan Reinink
b04dab6be6
Add will-change utilities (#5448)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-08 14:50:31 -04:00
Robin Malfait
eb3fe8fe27
ensure that divide utilities inject a default border color (#5438) 2021-09-08 11:39:32 +02:00
Adam Wathan
a5425abd86 Support any arbitrary value for accentColor 2021-09-07 21:12:57 -04:00
Luke Warlow
51f71af62c
Add accent-color utilities (#5387)
* Add accent-color utilities

* Address comments
2021-09-07 21:07:54 -04:00
Robin Malfait
f99302c626
Support @apply for classes outside of a @layer (#5378)
* support `@apply` for classes outside of a `@layer`

* Add failing test for respecting source order

* sort rules when using `@apply`

The `layer` was not taken into account yet when we resolved the rules
from the applyCache. This is because we set the `classCache` to the
`matches` inside of the `generateRules` function. You can think of them
as "raw" rules I guess. However, it is later in that function that we
apply the `layerOrder` to the `sort`.

This does mean that when you `@apply font-bold text-red-500` that the
rules inside the `.target {}` will be in order of the "normal" css as
well.

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-09-07 21:03:46 -04:00
Adam Wathan
db8b449a67
Enable extended color palette (#5384)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-06 14:29:03 -04:00
Robin Malfait
920f21264c
Simplify negate value (#5389)
* simplify `negateValue`

Co-authored-by: Brad Cornes <bradlc41@gmail.com>

* ensure we have the exact same behaviour

* Simplify/loosen regex to be more future-proof

Co-authored-by: Brad Cornes <bradlc41@gmail.com>
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-09-06 14:26:32 -04:00
Robin Malfait
a34bd62bb6
Remove lodash (#5390)
* remove `lodash` usage

* implement custom cloneDeep to replace lodash's

* drop lodash in processPlugins

* add `toPath` utility

* add `tap` utility

* add `cloneDeep` utility

* drop lodash in evaluateTailwindFunctions

* add `defaults` utility

* drop lodash from `resolveConfig`

* remove `lodash` dependency
2021-09-06 14:15:10 -04:00
Robin Malfait
2dac5bb569
Add custom plugins tests (#5383)
* add tests for the plugin API

* make plugin invocation optional

It could be that an object has been passed as a plugin, in that case we
will use the `handler` function from the object. If it doesn't exist,
then we will only take the `config` section out of it.
2021-09-04 16:33:55 +02:00
Robin Malfait
c315db5f15
port @layer tests from AOT to JIT mode (#5379) 2021-09-03 17:46:15 +02:00
Jonathan Reinink
4f89215d88
Unify config helpers into single object (#5382)
Co-Authored-By: Adam Wathan <4323180+adamwathan@users.noreply.github.com>

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2021-09-03 10:31:19 -04:00
Robin Malfait
e37931ba65
JIT by default - move tests and make them consistent (#5374)
* move `./tests/jit` to `./tests`

* make tests consistent

Abstracted a `run` function and some syntax highlighting helpers for
`html`, `css` and `javascript`.
2021-09-03 13:48:16 +02:00
Jonathan Reinink
e9cde3a070
Add native aspect ratio support (#5359) 2021-09-02 08:32:02 -04:00
Robin Malfait
7852d4f12f
Throw an error when applying the .group utility (#4666) 2021-09-01 18:08:35 +02:00
Hunter Tunnicliff
721e57312b
Fix formatting 2021-09-01 17:28:30 +02:00
Hunter Tunnicliff
70787fc088
Add tests 2021-09-01 17:28:30 +02:00
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
Robin Malfait
97804a8950
Pin clean css version (#5338)
* pin clean-css to version `5.1.4`

* update fixtures
2021-08-30 13:00:50 +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
96ef15039b
Ensure purge tests work even for version mismatches (#5316)
We applied the same treatment for the sanity tests, where we ignore the
first line (the tailwind header).

An odd issue I have found is that diffing of big css files is _very_
slow. When te tests pass, then the first test takes `3302 ms`, however,
when it fails it takes `477482 ms` on my machine. That's almost 8
minutes.
2021-08-27 15:47:39 +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
Adam Wathan
723e8d4377
Improve accessibility of default link focus styles in Firefox (#5082) 2021-07-31 07:10:17 -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
f7e9831436 Update version in fixtures 2021-07-26 09:01:41 -04:00
Adam Wathan
90da0b3a7c Rebuild fixtures 2021-07-21 15:47:24 -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
81f9e940b4 Update version in fixtures 2021-07-21 10:23:20 -04:00
Nestor Vera
cc4aaaaa49
Add new utility for align-self: baseline (#5000) 2021-07-17 15:19:14 -04:00
Adam Wathan
f20655c2d3
Fix backdrop opacity variants (#4892)
We weren't generating backdrop opacity variants properly due to a typo in the default config.
2021-07-04 09:50:14 -04:00
Adam Wathan
a3230307f3
Ensure [hidden] works as expected (#4873) 2021-07-02 09:14:03 -04:00
Adam Wathan
4a070ac0be
Try to use lowest impact selector when filling in defaults (#4866) 2021-07-01 17:18:46 -04:00
Sergey Tatarintsev
2166b76c53
Improve production build performance for the case of many small non-tailwind stylesheets (#4644)
* Improve `purge` performance in layers mode

In layers mode, skip `purgecss` completely if source stylesheet does
not have any tailwind layers. For the legacy codebases with a lot of
non-tailwind stylesheets, it dratically improves the performance of
the production build.

* fix: purgecss should respect safelist.variables
2021-07-01 14:25:06 -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
369c7b5f0c
Ensure resorted plugins take into account all plugins they need to sort relative to (#4852) 2021-07-01 05:59:47 -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
Tim
fdfecf3b9c
Add step-start and step-and to timings constant (#4795)
Co-authored-by: Tim Kleyersburg <tk@wacg.de>
2021-06-24 10:49:57 -04:00
Adam Wathan
b3d5b4e000 Rebuild fixtures 2021-06-23 16:22:01 -04:00