Skip to content

Commit

Permalink
Ignore CSS variables
Browse files Browse the repository at this point in the history
  • Loading branch information
hugopeek committed Jun 17, 2023
1 parent 9a04d83 commit b2a0353
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/CssLint/Linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,15 @@ protected function lintPropertyNameChar(string $sChar): ?bool
}

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

// Ignore CSS variables (names starting with --)
if (substr($sPropertyName, 0, 2) === '--') {
$this->setContext(self::CONTEXT_PROPERTY_CONTENT);
return true;
}

// Check if property name exists
if (!$this->getCssLintProperties()->propertyExists($sPropertyName)) {
$this->addError('Unknown CSS property "' . $sPropertyName . '"');
}
Expand Down

0 comments on commit b2a0353

Please sign in to comment.