Why
Hello. 👋 I'm trying to add CSS Custom Properties within the style element but failing to find a good way to handle this either via a regular expression or transformer.
How
I would like to allow the following:
<html>
<head>
<style>
.test {
--font: Verdana;
}
</style>
</head>
</html>
In this case, I'm wanting to allow --font as a custom property but, in truth, I'd like to allow all custom properties via a regular expression: /^--/ but that doesn't work. Snippet:
Sanitize::Config::RELAXED[:css].dup.tap { it[:properties] = it[:properties].including(/^--/) }
Notes
Would it be possible to filter by regular expression as part of the include list or am I missing a way to handle this via a transformer?