mui / pigment-css

Pigment CSS is a zero-runtime CSS-in-JS library that extracts the colocated styles to their own CSS files at build time.
MIT License
753 stars 38 forks source link

Class name customize API #276

Open oliviertassinari opened 1 week ago

oliviertassinari commented 1 week ago

Summary

Today, the class names look something like this:

SCR-20241013-bpwm

It's far from great DX, especially in dev-mode. It's actually a DX regression compared to emotion/sc.

Instead, I believe that we should get:

SCR-20241013-btzi

How do we get the name? Either from the JavaScript variable name, or using some kind of a configurator. For example, sc uses withConfig({ displayName }), emotion uses styled(, { label }.

Here, it's important to distinguish labels that developers can add without thinking about unicity and the ones that are guaranteed to be unique.

Examples

No response

Motivation

No response

Search keywords: -

brijeshb42 commented 3 days ago

This is already in the works and will be part of v1. Default will always be random class though.