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.

String styles: please make it easy

See original GitHub issue

10.0.0-beta.2 notes say:

We removed support for string styles in favor of setting style properties only with objects. This aligns our behavior with various other virtual-dom based libraries out there ✔️ Nonetheless we are aware that this might be a controversial change. If you have a lot of string styles or want to continue using them, you can use preact-string-styles to patch this behavior back into Preact X. If you don’t agree this change, please let us know!

Let it be known: I’d much prefer to allow string styles. Indeed, the lighter-touch approach that keeps Preact JSX markup closer to actual HTML was one of my motivations for choosing it. I’d also be OK with an NPM package that delivers the functionality of preact-string-styles, whereas currently it’s a gist.

On the plus side, I’d also like to report that string styles still seem to be working fine for me in this beta, at least when rendering to strings via preact-render-to-string. (In my application, that’s all I need – perhaps the lack of support is in render()?)

In case you’re curious about my application: I’m using JSX as a way to write beautiful code that generates SVG. (Here’s a simple example.) Thus, I’d like the markup part to look as much like actual SVG as possible. But I realize this isn’t the standard application of Preact, so you might want to relegate this feature to a package.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (13 by maintainers)

github_iconTop GitHub Comments

5reactions
marvinhagemeistercommented, Jun 28, 2019

Ok, so after re-reading the thread and everyone’s opinion I’ve come to the conclusion that we should bring string styles back. My reasoning is that we’d break a lot of existing preact apps and we shouldn’t do such change so short before a final X release.

String styles are part of the DOM interface after all and we’ve profited from them in the past back when we lacked support for CSS variables in preact. On top of that having string styles is a lower barrier to entry for beginners as they can just copy & paste their existing html code into jsx and have it work out of the box.

I’ve made #1744 accordingly which brings back string styles.

5reactions
marvinhagemeistercommented, Jun 17, 2019

I’m wondering if we should bring them back mainly for the reason that we advertise as being “closer to the metal” and string styles fit into that description.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vintage Tuners: String Change Guide Made EASY! - YouTube
This video will show you my method for restringing any Fender or Squier guitar with vintage- style Tuners. This guide will show you...
Read more >
Learn How To Make A Cute Star String Figure/String Trick
The Japanese call these Ayatori. Instructions for how to make a star cat's cradle string figure out of string in this easy step...
Read more >
Easy String Arranger - YouTube
Of the 3 Easy String Arranger features, "Harmonize" is the most useful. You can create really great and fun to play harmonies by...
Read more >
Updated* How to String a Guitar with Vintage Style Tuners
This updated guide will show you the way in which I restring an electric guitar with vintage- style tuners. My original video had...
Read more >
DIY Friendship Bracelets. 5 Easy DIY Bracelet Projects!
I used four different colors of embroidery string to get a lovely color blocking bracelet. I love how simple this bracelet is to...
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