Skip to content

Commit 4fb41db

Browse files
Address feedback
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
1 parent 928eab3 commit 4fb41db

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

packages/tailwindcss/src/compile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function compileCandidates(
4949

5050
let flags = CompileAstFlags.None
5151

52-
if (respectImportant || respectImportant === undefined) {
52+
if (respectImportant ?? true) {
5353
flags |= CompileAstFlags.RespectImportant
5454
}
5555

@@ -136,7 +136,7 @@ export function compileAstNodes(
136136
let asts = compileBaseUtility(candidate, designSystem)
137137
if (asts.length === 0) return []
138138

139-
let respectImportant = Boolean(flags & CompileAstFlags.RespectImportant)
139+
let respectImportant = designSystem.important && Boolean(flags & CompileAstFlags.RespectImportant)
140140

141141
let rules: {
142142
node: AstNode
@@ -154,7 +154,7 @@ export function compileAstNodes(
154154
// If the candidate itself is important then we want to always mark
155155
// the utility as important. However, at a design system level we want
156156
// to be able to opt-out when using things like `@apply`
157-
if (candidate.important || (designSystem.important && respectImportant)) {
157+
if (candidate.important || respectImportant) {
158158
applyImportant(nodes)
159159
}
160160

packages/tailwindcss/src/design-system.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,7 @@ export function buildDesignSystem(theme: Theme): DesignSystem {
141141
parseVariant(variant: string) {
142142
return parsedVariants.get(variant)
143143
},
144-
compileAstNodes(candidate: Candidate, flags?: CompileAstFlags) {
145-
flags ??= CompileAstFlags.RespectImportant
146-
144+
compileAstNodes(candidate: Candidate, flags = CompileAstFlags.RespectImportant) {
147145
return compiledAstNodes.get(flags).get(candidate)
148146
},
149147

0 commit comments

Comments
 (0)