stylers icon indicating copy to clipboard operation
stylers copied to clipboard

Why pass in component name / how to deal with collisions?

Open bluenote10 opened this issue 1 year ago • 10 comments

First of all, thanks for creating this library, this looks really promising!

I'm wondering why the style! macro requires to pass in a component name?

Initially I thought this is used as the CSS class name, and I was worried how to prevent collisions. Looking a bit under the hood shows that the class name is already random (or hash) based, so the risk of a collision is small (or impossible?). Apparently the name is only used for the file name in target/stylers/css. But why not use simply use the same unique name as for the CSS style itself? If a project grows in size, or when mixing third party component libraries, a collision could happen at some point.

It looks like currently collisions of the files names are not detected / handled, right? At least creating a collision on purpose seems to simply overwrite the file, i.e., the resulting styles are broken.

bluenote10 avatar Apr 16 '23 14:04 bluenote10