Natural CSS in TypeScript
[!WARNING] This project is still in WIP, which means it is not ready for production.
See @mincho-js/css
README.
It started with contemplation on approaches and management methods for CSS styling.
Methodologies for CSS selectors can be largely divided into visual hierarchy and semantic hierarchy.
The visual hierarchy uses visual names like .text-red { color: red; }
,
while the semantic hierarchy uses meaningful names like .error { color: red; }
.
Due to these characteristics, the methods of achieving goals also differ.
For example, what if we need to create various designs with the same content, like as CSS Zen Garden?
The visual approach would keep the CSS fixed but change the HTML to achieve the goal,
while the semantic approach would keep the HTML the same but change the CSS to achieve the goal.
As a practical example of dealing with visual hierarchy, there's Tailwind CSS, and for semantic hierarchy, there's Stitches.
If you look at Tailwind's Text Color, you can see it's visually intuitive with classes like text-black
, text-white
.
Stitches has invented an API called Variants, which aligns with the original purpose of CSS classes as element identifiers[1, 2], and makes it very easy to apply BEM.
I believed that these two approaches could reconcile and form a dialectical triad.
Just like how the cool and refreshing taste of mint harmonizes with the sweetness of chocolate in mint chocolate!
"Build your own design system" is our vision.
We aim not only to integrate visual hierarchy and semantic hierarchy but also to improve the design process itself.
This is achieved under several principles:
Our CSS in JS framework will consist of 5 layers (Literal, Theme, Atomic, Variant, Styled Component).
This can also be compared with State[1, 2]:
However, since we cannot provide all features from the beginning, we plan to achieve them step by step.
Currently, most of the features are related to the CSS preprocessor.
Interested in contributing?
We have a contributing guide.
If you need support, ask in discussions.
Participation is open. Welcome! :hugs: :hugs:
Do you have any questions?
Feel free to ask questions in discussions.
This project was inspired by the syntax and functionality of various projects.
Without them, this would not be possible!!
@keyframes
(anonymous at-rules).MIT License © 2023-Present Minseok Youn