Add $ and _ handling in CSS

This commit is contained in:
Talia 2021-10-19 20:01:10 +02:00
parent 13f8ba591a
commit f877be4806
No known key found for this signature in database
GPG Key ID: AD727AD22802D0D6
1 changed files with 6 additions and 1 deletions

7
css.js
View File

@ -1,6 +1,11 @@
const diversify = (prefix, now, ...rest) =>
now
? now.split(/, */g).map(current => diversify(prefix+' '+current, ...rest)).join(",")
? now.split(/, */g)
.map(current => current.replace(/\$/g, '.'))
.map(current => current[0] == "_"
? diversify(prefix+current.slice(1), ...rest)
: diversify(prefix+' '+current, ...rest)
).join(",")
: prefix
const keyToPropName = key => key.replace(/^[A-Z]/, a => "-"+a).replace(/[A-Z]/g, a => '-'+a.toLowerCase())