3146 Commits

Author SHA1 Message Date
Robin Malfait
e39fd6f2b3 remove the reversed orderedUtilityMap
We don't require this reversed map since we can already sort by the
index on the node directly. Therefore this can be dropped.
2020-08-18 08:21:33 -04:00
Robin Malfait
88888fd0f8 switch to a do {} while ()
We alreayd know that we have an `@apply` otherwise we would not have
called that function in the first place. Moving to a `do {} while ()`
allows us to skip 1 call to `hasAtRule(css, 'apply')`. Which is nice
because that skips a possible full traversal.
2020-08-18 08:21:33 -04:00
Robin Malfait
f2e3e22c6b make the cloning of the rule in the lookup table lazy
We create a big lookup table so that we can lookup the nodes by its
utilityName. This is used inside the recursive `@apply` code.

This big lookup table will clone every single rule and put it in,
however we don't need to clone everything! We are only interested in the
rules that have been actually applied.

This way we make the cloning of the rule lazy and only when we use this
exact rule.

There is an additional performace "issue" though: When we read the same
rule multiple times, it will clone every time you read from that object.
We could add additional memoization stuff, but so far it doesn't seem to
be the bottleneck. Therefore I've added a perf todo just to leave a mark
when this becomes the bottleneck.
2020-08-18 08:21:33 -04:00
Robin Malfait
5564e0b493 remove unused containsApply check
Currently we will walk the tree for every single rule to see if an
`@apply` exists somewhere in that tree. However we don't use the
`containsApply` anymore so this is a quick win!
2020-08-18 08:21:33 -04:00
Robin Malfait
aa7ae6af37 re-use classNameParser
We were re-creating the classNameParser inside the loop. Since that code
is all pretty pure we can hoist it so that we don't have to recreate
that parser all the time.
2020-08-18 08:21:33 -04:00
Robin Malfait
8c7fb84e58 bail out of the applyComplexClasses when it is not needed
There is no need in re-compiling tailwind or building expensive lookupt
tables when it turns out that we don't even need it.

We have a small overhead by walking the tree to check if `@apply`
exists. However this outweighs the slowness of re-generating tailwind +
expensive lookup tables.
2020-08-18 08:21:33 -04:00
Robin Malfait
4b15b90f21 add perf utils 2020-08-18 08:21:33 -04:00
Adam Wathan
053ab65cee Update flagged fixture 2020-08-18 08:21:22 -04:00
Adam Wathan
7945f0f7c8
Merge pull request #2176 from tailwindlabs/gradients
Add background gradient support
2020-08-18 08:06:50 -04:00
Adam Wathan
1d2dd1a5f4
Merge pull request #1965 from juno-w/master
Divide border style
2020-08-17 21:13:49 -04:00
Adam Wathan
4ca48dbde5 Add catch arg 2020-08-17 14:18:42 -04:00
Adam Wathan
926b6b1fab Rename mid color stop to via 2020-08-17 13:25:18 -04:00
Adam Wathan
18873e896a Add "to" to gradient background class names 2020-08-17 11:50:35 -04:00
Adam Wathan
8d87445b81 Improve API, support auto-transparent to, rename gradientColor plugin 2020-08-17 11:05:06 -04:00
Adam Wathan
7fb5d4a579 Add support for background images and 2/3-color-stop gradients 2020-08-16 15:23:49 -04:00
Adam Wathan
5b11f9c82a
Merge pull request #2168 from tailwindlabs/bg-clip
Add background-clip utilities
2020-08-15 18:07:22 -04:00
Adam Wathan
488c0e35c9 Don't include vendor prefix for background-clip: text
Better to rely on autoprefixer for this for now. If we want to start shipping prefixes we should do it across the board, not just in one spot.
2020-08-15 16:24:21 -04:00
Adam Wathan
5b82b6f5ac Add background-clip utilities 2020-08-15 16:20:33 -04:00
Adam Wathan
8a066c27a2 Merge branch 'apply-complex-classes' 2020-08-15 15:39:48 -04:00
Adam Wathan
6b32635f2c Explain other code branch when processing @apply rules 2020-08-15 15:39:39 -04:00
Adam Wathan
9d257a986c Rename inject instances to apply 2020-08-15 15:31:26 -04:00
Adam Wathan
cebed0e4e0 Only include contents class in modern builds, update fixtures 2020-08-15 15:22:31 -04:00
Adam Wathan
94325f5710 Merge branch 'patch-1' of git://github.com/mtimbs/tailwindcss into mtimbs-patch-1 2020-08-15 15:20:23 -04:00
Adam Wathan
7371ea992b
Merge pull request #1676 from innocenzi/color-closure
Allow colors to be defined as closures
2020-08-15 09:09:46 -04:00
Adam Wathan
e37b665b60 Support applying classes that occur multiple times in a single selector 2020-08-14 19:12:45 -04:00
Adam Wathan
6fe745b908 Improve comment 2020-08-14 13:26:14 -04:00
Adam Wathan
cef0b84abf Reorganize prototype code 2020-08-14 12:23:28 -04:00
Adam Wathan
577f536eeb Update tests that relied on changed implementation details 2020-08-14 12:23:18 -04:00
Adam Wathan
b527dcf301 Improve test name 2020-08-14 11:26:01 -04:00
Adam Wathan
23ffa25e8a Avoid accidentally forgetting getProcessedPlugins arg when customizing config 2020-08-14 11:25:55 -04:00
Adam Wathan
b518dc3e4c Test applying classes with a prefix configured 2020-08-14 11:15:45 -04:00
Adam Wathan
e03db68ff9 Fix test typo 2020-08-14 11:15:17 -04:00
Adam Wathan
2cbc8e90af Add tests for all the new scenarios @apply now supports 2020-08-13 20:46:27 -04:00
Adam Wathan
8646c94dd5 Prepend a shadow lookup table when no @tailwind rules are in the tree 2020-08-13 20:16:56 -04:00
Adam Wathan
c252e33254 Get shadow lookup working-ish with new apply approach 2020-08-13 12:14:26 -04:00
Adam Wathan
6f1fb5c401 Drop entries methods for lodash 2020-08-13 09:35:45 -04:00
Adam Wathan
ba9ee0600b Remove unused expected 2020-08-13 09:01:58 -04:00
Adam Wathan
1c23b0a9ed Use lodash for flatMap 2020-08-13 08:56:27 -04:00
Adam Wathan
3d156cc81f Explicitly don't support legacy cssnext @apply rules 2020-08-13 07:51:46 -04:00
Adam Wathan
e313de6354 Fix lint issues 2020-08-13 07:45:04 -04:00
Adam Wathan
d6e22b944e Remove leading dot from apply case in sanity test 2020-08-13 07:44:59 -04:00
Adam Wathan
36fc03b16d Add initial support for applying variants and other complex classes 2020-08-12 19:47:21 -04:00
Adam Wathan
1791768a56
Merge pull request #2147 from jbergstroem/feature/node-update
Add Node.js 14.x to test matrix
2020-08-07 17:03:34 -04:00
Johan Bergström
437b038d41 Add Node.js 14.x to test matrix 2020-08-07 15:45:59 -04:00
Adam Wathan
89461f9999
Merge pull request #2145 from tailwindlabs/extended-font-size-scale
Add experimental extendedFontSizeScale
2020-08-07 15:17:36 -04:00
Adam Wathan
aa810673f4 Add experimental extendedFontSizeScale 2020-08-07 15:10:10 -04:00
Adam Wathan
cfb9996edf
Merge pull request #2143 from tailwindlabs/default-line-heights
Add experimental default line heights
2020-08-07 14:54:34 -04:00
Adam Wathan
4d2e4119fd Add experimental default line heights 2020-08-07 14:42:43 -04:00
Adam Wathan
037416ac70
Merge pull request #2144 from tailwindlabs/fix-font-size-theme-bug
Fix font size theme bug
2020-08-07 14:40:01 -04:00
Adam Wathan
a84deb4ac5 Fix bug where theme('fontSize.xl') breaks with default line-height 2020-08-07 14:32:47 -04:00