question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Converting pure css code to styled-components (Question)

See original GitHub issue

I tend to get lots of pure Html and css code from designers that I need to integrate in to a React App. I tried to convert html to JSX (change class to className). However, since I’m using Create React App for lot of these projects I’m not using CSS modules so the css is never locally scoped. This is an issue because the class names are not always uniquely named by designers. I love using styled-components so If was hoping I can utilize it but I can’t seem to figure out How I can use the existing css code and build out styled variables to use in a converted html code to use those converted styled variables .

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

17reactions
iMericacommented, Dec 14, 2019

Did anyone ever come up with a way to automatically compile plain css to style components?

2reactions
SaarasMcommented, Jul 22, 2021

I believe you can use this: metacomponent

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert CSS in React To Styled Components - YouTube
Styled Components is one of those interesting topics that developers love to argue about. It's a brand new way of doing things that...
Read more >
how do I convert this styled-components code using TSX?
I'm new to TS, so this code might looks ugly :( import styled, { css } from 'styled-components'; interface defineProps { readonly left ......
Read more >
styled-components: Advanced Usage
styled -components has full theming support by exporting a <ThemeProvider> wrapper component. This component provides a theme to all React components underneath ...
Read more >
Moving from SCSS to styled-components: Advantages and ...
In this guide, we'll explore both options and evaluate the advantages and disadvantages of moving from SCSS to styled-components in your React ...
Read more >
Complete Guide On How To Use Styled-components In ...
From the code above, we can see CSS being used in JavaScript template literals to attach styles to the Button component. The styled...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found