[v4] Support old important modifier position (#13103)
* Support old important modifier position * update --------- Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com> Co-authored-by: Jordan Pittman <jordan@cryptica.me>
This commit is contained in:
parent
19fcd0ebba
commit
b3b2debdd9
2 changed files with 14 additions and 0 deletions
|
|
@ -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, '/')
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue