Can we use Master CSS for React Component Library? #69
Replies: 2 comments
-
@elamandeep Thx for the support and these questions are sensible 👍🏻 Q1: Will it works for JSX?We created a syntactic sugar similar to the concept of Styled Components, which can greatly simplify and reuse your code. import element from '@master/style-element.react'
const Button = element.button`inline-flex font:14`
export default function App() {
return (
<Button className="uppercase">submit</Button>
)
}
Q2: Final bundle size of final CSS codeIt depends on the compilation mode you adopt. JIT CompilationIt's 🤯 zero CSS bundle in JIT compilation. <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.master.co/css"></script>
</head>
<body>
<h1 class="font:40 font:heavy italic m:50 text:center">Hello World</h1>
</body>
</html> The matching and generation cycle for each class name takes about ~0.01ms. It's super fast, so you hardly have to worry about performance. CSS Hydration ( SSG/SSR + JIT )We're probably the first CSS language to come up with CSS hydration techniques. We currently only have the guide for Next.js and let me explain with it. The following example is to add pre-generated CSS to the Next.js main file and inject it inline into the So what role does JIT play here? You might have logic like this in your JSX source code: <div className={isOpen ? 'block' : 'hide'}> Assuming ...
<head>
<style>.block{display:block}</style>
</head>
... But the CSS rule of You can even do things that AOT can't: <div className={`font:${size}`}>
AOT Compilation at v2.0We're currently working on 2.0 in full force, and the production version may be released in more than a month. Here's a brief introduction:
Q3: How will I use final CSS code?
Writing something html: <div class="font:heavy font:24@md hide@print">... And automatically generate CSS to inject into HTML or browser: .font\:heavy {
font-weight: 900
}
@media print {
.hide\@print {
display: none
}
}
@media (min-width:1024px) {
.font\:24\@md {
font-size: 1.5rem
}
} Q4: Any Concept of grouping
Check out the simple documentation —— Reusing Design - Master CSS Q5. Will it work properly for my library ?
Any question ask us:Join our discord channel |
Beta Was this translation helpful? Give feedback.
-
@1aron Thanks for your response 🙏 |
Beta Was this translation helpful? Give feedback.
-
Hi Master CSS Team! Loved the idea behind Master CSS. Actually , I am working on my React UI library and I don't want to use CSS in JS library. So, I am looking towards utility frameworks like Tailwind CSS. The problem with Tailwind CSS we can't use sass like feature. So , i thought of using something like sass and I found Master CSS. I will soon going to learn and implement into my React UI Library.
Few questions wandering in my mind 👇
I am bit tensed about last question.
Beta Was this translation helpful? Give feedback.
All reactions