File tree 2 files changed +20
-1
lines changed
packages/tailwindcss-language-server/src/language 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ test('@utility', () => {
50
50
'@utility foo-* {' ,
51
51
' color: red;' ,
52
52
'}' ,
53
+ '@utility bar-* {' ,
54
+ ' color: --value(--font-*-line-height);' ,
55
+ '}' ,
53
56
]
54
57
55
58
let output = [
@@ -60,6 +63,9 @@ test('@utility', () => {
60
63
'.placeholder {' , // wrong
61
64
' color: red;' ,
62
65
'}' ,
66
+ '.placeholder {' , // wrong
67
+ ' color: --value(--font-_-line-height);' ,
68
+ '}' ,
63
69
]
64
70
65
71
expect ( rewriteCss ( input . join ( '\n' ) ) ) . toBe ( output . join ( '\n' ) )
@@ -70,11 +76,15 @@ test('@theme', () => {
70
76
//
71
77
'@theme {' ,
72
78
' --color: red;' ,
79
+ ' --*: initial;' ,
80
+ ' --text*: initial;' ,
73
81
' --font-*: initial;' ,
74
82
' --font-weight-*: initial;' ,
75
83
'}' ,
76
84
'@theme inline reference static default {' ,
77
85
' --color: red;' ,
86
+ ' --*: initial;' ,
87
+ ' --text*: initial;' ,
78
88
' --font-*: initial;' ,
79
89
' --font-weight-*: initial;' ,
80
90
'}' ,
@@ -84,11 +94,15 @@ test('@theme', () => {
84
94
//
85
95
'.placeholder {' , // wrong
86
96
' --color: red;' ,
97
+ ' --_: initial;' ,
98
+ ' --text_: initial;' ,
87
99
' --font-_: initial;' ,
88
100
' --font-weight-_: initial;' ,
89
101
'}' ,
90
102
'.placeholder {' , // wrong
91
103
' --color: red;' ,
104
+ ' --_: initial;' ,
105
+ ' --text_: initial;' ,
92
106
' --font-_: initial;' ,
93
107
' --font-weight-_: initial;' ,
94
108
'}' ,
Original file line number Diff line number Diff line change @@ -73,8 +73,13 @@ export function rewriteCss(css: string) {
73
73
return match . replace ( / [ * ] / g, '_' )
74
74
} )
75
75
76
+ // Replace `--*` with `--_`
77
+ // Replace `--some-var*` with `--some-var_`
76
78
// Replace `--some-var-*` with `--some-var-_`
77
- css = css . replace ( / - - ( [ a - z A - Z 0 - 9 - ] + ) - [ * ] / g, '--$1-_' )
79
+ // Replace `--text-*-line-height` with `--text-_-line-height`
80
+ css = css . replace ( / - - ( [ a - z A - Z 0 - 9 - * ] * ) / g, ( match ) => {
81
+ return match . replace ( / [ * ] / g, '_' )
82
+ } )
78
83
79
84
return css
80
85
}
You can’t perform that action at this time.
0 commit comments