-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
css: migrate from styled comps to plan css or css-modules #792
Comments
I would check if there are best practices around this. Also, would love to know @iAdramelk 's take on this. |
I don't think styled-components.com are so used that there will be broadly established practices around it but I did look this up just now and found https://medium.com/inturn-eng/naming-styled-components-d7097950a245 where they propose using |
|
Oh, and another option to consider for all this is to migrate to https://github.com/zeit/styled-jsx (supported out-of-box in Next.js) but doesn't support nested styles I think. |
Do you have a vote here, @iAdramelk? Thanks |
@jorgeorpinel I do think that we should probably move them to the separate files at least. I started experimenting with this approach in #874 (check the files in I checked |
Agree. Probably no need to rename them if they're moved. I'd call the source file
I don't really see the need. There's no locking since you can always rename them at import. I don't love any of the prefixes or suffixes we've suggested here anyway. |
Well, Agree about substituting Rewriting with https://github.com/css-modules/css-modules sounds like the easiest option to me at this point, BTW. But we can list and discuss the options in a new issue if you guys agree. |
Hey, https://emotion.sh is a thing. It has all the features of styled-components, plus it can easily give you class names that you can pass to random libraries on NPM, react or not. It's more likely that you can customise a className than that you're able to control the element generation just to change a style. Plus it has a Worth a look? |
@fabiosantoscode @iAdramelk is migrating dvc.org to Gatsby now and probably we'll use the same convention eventually (postcss?) . @iAdramelk could you shed some light here? |
@fabiosantoscode thanks for suggestion, but the thing is, we didn't really need css-in-js library. We don't use any of it's advanced capabilities and in our case just importing css without the need for a runtime will be a lot better for the perfomance. The main reason why we use |
@iAdramelk @shcheklein so is this issue still valid? If the Gatsby migration is definitive, let's close it? |
let's keep, we'll close all the tickets with the engine label (those that will become obsolete) at once after the migration. Since it's not over, the issue is still relevant. |
Fixed by the recent migration. |
Our styled components tend to be defined after the exported component in each file (pages/, src/) so it could be confusing to find them in the JSX of previously defined components.
However we want to keep them in the bottom of each file given their strange code format. The idea then is to RENAME them so it's more obvious that they are styled components. My proposal is to simply add the name of the HTML tag they use in CamelCase. For example a
Container
component that styles adiv
tag would be renamedContainerDiv
and look like this in JSX.UPDATE: Probably going for extracting and not renaming. See #792 (comment)
The text was updated successfully, but these errors were encountered: