Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/tailwindcss/src/candidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ export function parseCandidate(
base = base.slice(0, -1)
}

// Legacy syntax with leading `!`, e.g. `!mx-4`.
else if (base[0] === '!') {
state.important = true
base = base.slice(1)
}

// Arbitrary properties
if (base[0] === '[') {
let [baseWithoutModifier, modifierSegment = null] = segment(base, '/')
Expand Down
8 changes: 8 additions & 0 deletions packages/tailwindcss/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@ describe('important', () => {
`)
})

it('should generate an important utility with legacy syntax', () => {
expect(run(['!underline'])).toMatchInlineSnapshot(`
".\\!underline {
text-decoration-line: underline !important;
}"
`)
})

it('should not mark declarations inside of @keyframes as important', () => {
expect(
compileCss(
Expand Down