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.

Question: inline style generation

See original GitHub issue

On the web, each element that has the sx prop generates whole copy of its styles as inline ones, is that intended or should it be converted into styled components classnames? I wanted to ask before diving deeper into the potential performance issues it may create.

Example: devtools

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

3reactions
nandorojocommented, Apr 17, 2021

The best would really be to have a Babel plugin/macro that checks any static sx props and turns them into StyleSheet.create. I’ve discussed this with @natew, who made a cool and performant Babel solution for SnackUI.

Stuff like this might be what we need: https://youtu.be/9xTZSW2soBM

2reactions
nandorojocommented, Apr 20, 2021

1.5.10 adds className support for responsive styles too. Every sx prop now has cached class names.

Read more comments on GitHub >

github_iconTop Results From Across the Web

css - Generating a stylesheet based on inline HTML styling?
I've been working on styling different parts of my website for a while, however I have yet to put my inline styles into...
Read more >
Is it a bad practice to use inline styling with generated code?
Save this answer. Show activity on this post. Yes, inline styling is considered very poor practice. You have no centralized location for your...
Read more >
Inline CSS - BEE Pro Help Center
Inline CSS is very popular in email development. It's the most consistent way to ensure that designs will look the same in different...
Read more >
The Style Information element - HTML - MDN Web Docs
Inline styles take precedence over CSS included externally. The style attribute can override it, though.
Read more >
Example question for certification about inline CSS - OutSystems
One basic example is: imagine you have several pages of a web app where you are applying specific inline styles for a color...
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