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

7
css.js
View file

@ -1,6 +1,11 @@
const diversify = (prefix, now, ...rest) => const diversify = (prefix, now, ...rest) =>
now 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 : prefix
const keyToPropName = key => key.replace(/^[A-Z]/, a => "-"+a).replace(/[A-Z]/g, a => '-'+a.toLowerCase()) const keyToPropName = key => key.replace(/^[A-Z]/, a => "-"+a).replace(/[A-Z]/g, a => '-'+a.toLowerCase())