Skip to content

Commit fe0693c

Browse files
committed
skip css variable if not set (prevent warning on COOL side)
1 parent c156776 commit fe0693c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/helpers/coolParameters.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ const generateCSSVarTokens = () => {
128128
const lightStyle = window.getComputedStyle(lightElement).getPropertyValue(varName)
129129
const darkStyle = window.getComputedStyle(darkElement).getPropertyValue(varName)
130130

131-
str += varName.replace('--', '--nc-light-') + '=' + lightStyle.trim() + ';'
132-
str += varName.replace('--', '--nc-dark-') + '=' + darkStyle.trim() + ';'
131+
if (lightStyle) str += varName.replace('--', '--nc-light-') + '=' + lightStyle.trim() + ';'
132+
if (darkStyle) str += varName.replace('--', '--nc-dark-') + '=' + darkStyle.trim() + ';'
133133

134134
// Workaround for now as we need primary-invert-if-dark which is not available on server yet
135135
if (varName === '--primary-invert-if-bright') {

0 commit comments

Comments
 (0)