Skip to content

Commit edd5ad7

Browse files
authored
Update README.md
1 parent 296df22 commit edd5ad7

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

README.md

+21-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ MistCSS is a new, better and faster way to write visual components. ~~CSS-in-JS~
88

99
All major frameworks are supported.
1010

11-
## Write your component in CSS only
11+
## 1. Write your component in CSS only
1212

13-
This CSS is the only code you'll write for your component.
13+
`./src/Button.mist.css`
1414

15-
```css title="Button.mist.css"
15+
```css
1616
@scope (button.custom-button) {
1717
:scope {
1818
background: black;
1919
color: white;
2020

21-
/* Define component's props directly in your CSS 👇 */
21+
/* 👇 Define component's props directly in your CSS */
2222
&[data-variant="primary"] {
2323
background: blue;
2424
}
@@ -30,13 +30,27 @@ This CSS is the only code you'll write for your component.
3030
}
3131
```
3232

33-
## Get a type-safe component without writing TypeScript
33+
## 2. Run MistCSS codegen
3434

35-
```jsx title="App.tsx"
35+
```shell
36+
mistcss ./src --target=react --watch
37+
# It will create ./src/Button.mist.tsx
38+
```
39+
40+
## 3. Get a type-safe component without writing TypeScript
41+
42+
`./src/App.tsx`
43+
44+
```jsx
3645
import { CustomButton } from './Button.mist'
3746

3847
export const App = () => (
39-
<CustomButton variant="primary">Save</CustomButton>
48+
<>
49+
<CustomButton variant="primary">Save</CustomButton>
50+
51+
{/* TypeScript will catch the error */}
52+
<CustomButton variant="tertiary">Cancel</CustomButton>
53+
</>
4054
)
4155
```
4256

0 commit comments

Comments
 (0)