Skip to content

Commit 20bcd17

Browse files
hugopeekneilime
authored andcommitted
Ignore CSS variables
1 parent 9f4575f commit 20bcd17

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/CssLint/Linter.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,15 @@ protected function lintPropertyNameChar(string $sChar): ?bool
386386
}
387387

388388
if ($sChar === ':') {
389-
// Check if property name exists
390389
$sPropertyName = trim($this->getContextContent());
391390

391+
// Ignore CSS variables (names starting with --)
392+
if (substr($sPropertyName, 0, 2) === '--') {
393+
$this->setContext(self::CONTEXT_PROPERTY_CONTENT);
394+
return true;
395+
}
396+
397+
// Check if property name exists
392398
if (!$this->getCssLintProperties()->propertyExists($sPropertyName)) {
393399
$this->addError('Unknown CSS property "' . $sPropertyName . '"');
394400
}

0 commit comments

Comments
 (0)