3 ms·
As lots of comments have pointed out this is pretty useless in its current form. However, the general idea and direction is certainly worthwhile - a light and s
by skewart 11y ago
As lots of comments have pointed out this is pretty useless in its current form. However, the general idea and direction is certainly worthwhile - a light and simple solution for the universal pain point that is CSS.
A few ideas for where to take it come to mind:
Ditch the JS and just write a library of generic CSS classes that solve common use cases. Crucially these have to provide at least _some_ abstraction above raw CSS styles (e.g. "always-centered-vertically" and not "margin-left"). There are lots of these libraries out there already, but maybe there is room for something a little less opinionated, or lower level, or higher level, or whatever than what you get with, say, Bootstrap.
Keep JavaScript in the mix but use it at build time, not in the browser. Maybe you scan the source to see which classes are actually used and dynamically generate a .css file to send to the client that only includes those classes and no others. Or maybe you could use JS to do some fancier layout solving - depending on the structure of the dom elements in the source - to generate correct CSS attributes to support the abstraction.
I'm not super familiar with the state of CSS tools, so maybe things like what I'm describing already exist by the dozens. I just know that CSS is a pain, and I appreciate anyone who wants to make working with it easier.