Skip to content

Commit c0cc98c

Browse files
committed
cleanup unnecessary code
1 parent 8f74b3e commit c0cc98c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

Diff for: packages/tailwindcss/src/index.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -667,15 +667,13 @@ export async function compileAst(
667667
}
668668

669669
let didChange = false
670-
let emitNewCssVariables = false
671670

672671
// Add all new candidates unless we know that they are invalid.
673672
let prevSize = allValidCandidates.size
674673
for (let candidate of newRawCandidates) {
675674
if (!designSystem.invalidCandidates.has(candidate)) {
676675
if (candidate[0] === '-' && candidate[1] === '-') {
677-
emitNewCssVariables = designSystem.theme.markUsedVariable(candidate)
678-
didChange ||= emitNewCssVariables
676+
designSystem.theme.markUsedVariable(candidate)
679677
} else {
680678
allValidCandidates.add(candidate)
681679
}
@@ -697,7 +695,7 @@ export async function compileAst(
697695
// If no new ast nodes were generated, then we can return the original
698696
// CSS. This currently assumes that we only add new ast nodes and never
699697
// remove any.
700-
if (previousAstNodeCount === newNodes.length && !emitNewCssVariables) {
698+
if (previousAstNodeCount === newNodes.length) {
701699
compiled ??= optimizeAst(ast, designSystem)
702700
return compiled
703701
}

Diff for: packages/tailwindcss/src/theme.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,10 @@ export class Theme {
185185
markUsedVariable(themeKey: string) {
186186
let key = unescape(this.#unprefixKey(themeKey))
187187
let value = this.values.get(key)
188-
if (!value) return false // Unknown variable
189-
if (value.options & ThemeOptions.USED) return false // Variable already used
188+
if (!value) return // Unknown variable
189+
if (value.options & ThemeOptions.USED) return // Variable already used
190190

191191
value.options |= ThemeOptions.USED
192-
return true
193192
}
194193

195194
resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null {

0 commit comments

Comments
 (0)