Converting pure css code to styled-components (Question)
See original GitHub issueI 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:
- Created 6 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Did anyone ever come up with a way to automatically compile plain css to style components?
I believe you can use this: metacomponent