anp / moxie

lightweight platform-agnostic tools for declarative UI
https://moxie.rs
Apache License 2.0
827 stars 27 forks source link

Locally scoped css #278

Open clinuxrulz opened 3 years ago

clinuxrulz commented 3 years ago

Is there any plans to support locally scoped css in moxie-dom?

anp commented 3 years ago

I'm reading about locally scoped CSS for the first time and it seems really cool! It looks like in order to support it we'd need to expose access to the style field of DOM nodes to let values be set directly. Seems doable but haven't looked into how to do it concretely yet.

clinuxrulz commented 3 years ago

I believe the bundlers for React, Svelte, SolidJS etc. actually create a global css at the end from the users given locally scoped css. They do this by generating non-conflicting class names so the end user can reuse a css class name while only having a local effect on the the style of their DOM. Widespread web-browser support for locally scopped css is not likely to come anytime soon, thats why the compiled it into a single global css.