I am playing around with the idea of having CSS variables in a TOML configuration. For that to work the config will be in camel case and needs to be translated into lower cases with dashes.
I couldn’t find a function that does that, something like camel case to urlize.
Currently I think it’s a sequence like this:
- Do a replaceRE over the key (see this regexp test)
- lower case it
- trim extra dashes - the last item has a dash at the end because of the weird OR syntax
Is that the proper way or do I miss an easy way?
config sample in TOML:
someCamelCase = "#123456"
is supposed to end up as