However, I don't want to be converting camelCase for the following transform properties: translateX, translateY, translateZ, skewX, skewY, scaleX, scaleY, scaleZ, rotateX, rotateY, rotateZ.
I thought that I could adjust the expression to exclude X, Y & Z, i.e.
Currently I'm matching any camelCase words in the
animDetails
string and converting them to kebab-case: https://github.com/ssbc/visual-docs/blob/3e42f0216f621e5da85eb7e98439991192148d05/js/convert-anime-to-css.js#L154 This does the right thing forstrokeDashoffset
andtransformOrigin
, which should be converted tostroke-dashoffset
andtransform-origin
in CSS.However, I don't want to be converting camelCase for the following transform properties:
translateX
,translateY
,translateZ
,skewX
,skewY
,scaleX
,scaleY
,scaleZ
,rotateX
,rotateY
,rotateZ
.I thought that I could adjust the expression to exclude X, Y & Z, i.e.
But that only does half the job. The hyphens are correctly applied:
strokeDashoffset
→stroke-Dashoffset
translateX
→translateX
but then
.toLowerCase()
is of course applied to all ofanimDetails
rather than just the match, so I end up with:stroke-Dashoffset
→stroke-dashoffset
translateX
→translatex
According to some references I should be able to convert to lowercase within Regex using
\L
which I tried to add into my.replace()
argument:But I don't think that means Regex in JS in the browser - it just ended up adding an 'L' character :(
strokeDashoffset
→stroke-LDashoffset