Skip to content

Instantly share code, notes, and snippets.

@sudarshang
Created March 22, 2018 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudarshang/b0ea5acf083dd9d194fe808a46b509b8 to your computer and use it in GitHub Desktop.
Save sudarshang/b0ea5acf083dd9d194fe808a46b509b8 to your computer and use it in GitHub Desktop.
Convert css in js to styled component
video = {
width: '100%',
verticalAlign: 'bottom',
maxHeight: '508px',
objectFit: 'contain',
background: '#000000',
}
camelCaseToDash = (str) => str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`);
Object.entries(video).forEach(([key, value]) => {
console.log(`${camelCaseToDash(key)}: ${value};\n`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment