Skip to content

Commit 8c7fb84

Browse files
RobinMalfaitadamwathan
authored andcommitted
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.
1 parent 4b15b90 commit 8c7fb84

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/flagged/applyComplexClasses.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ function processApplyAtRules(css, lookupTree, config) {
236236

237237
export default function applyComplexClasses(config, getProcessedPlugins) {
238238
return function(css) {
239+
// We can stop already when we don't have any @apply rules. Vue users: you're welcome!
240+
if (!hasAtRule(css, 'apply')) {
241+
return css
242+
}
243+
239244
// Tree already contains @tailwind rules, don't prepend default Tailwind tree
240245
if (hasAtRule(css, 'tailwind')) {
241246
return processApplyAtRules(css, css, config)

0 commit comments

Comments
 (0)