-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
130 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
title: Quick Start | ||
--- | ||
|
||
## Install | ||
|
||
```sh | ||
npm install --save-dev mistcss | ||
``` | ||
|
||
Assuming your components are in `./components`: | ||
|
||
```json title="package.json" copy | ||
{ | ||
"scripts": { | ||
"mistcss:dev": "mistcss ./components --watch", | ||
"mistcss:build": "mistcss ./components" | ||
} | ||
} | ||
``` | ||
|
||
You may want to use [concurrently](https://github.com/open-cli-tools/concurrently) to run `mistcss:dev` in parallel with your dev server. | ||
|
||
When building, `mistcss:build` must be run first. | ||
|
||
## Write | ||
|
||
Let's say you want to write a button component. It should have a default style and accept variants: | ||
|
||
```css title="./components/Button.mist.css" | ||
@scope (button.custom-button) { | ||
:scope { | ||
background: black; | ||
color: white; | ||
|
||
&[data-variant='primary'] { | ||
background: blue; | ||
} | ||
|
||
&[data-variant='secondary'] { | ||
background: gray; | ||
} | ||
} | ||
} | ||
``` | ||
|
||
:::note | ||
|
||
The above code is 100% valid CSS and natively supported by browsers. | ||
|
||
::: | ||
|
||
:::note | ||
|
||
MistCSS components support enum, boolean and string props. See [Writing Components](components). | ||
|
||
::: | ||
|
||
## Build | ||
|
||
```shell | ||
npm run mistcss:dev | ||
# MistCSS will create ./components/Button.mist.tsx | ||
``` | ||
|
||
## Use | ||
|
||
Use it in your app. No JS/TS were written ✨ | ||
|
||
```jsx title="App.tsx" | ||
import { CustomButton } from './Button.mist' | ||
|
||
export const App = () => <CustomButton variant="primary">Save</CustomButton> | ||
``` | ||
|
||
:::note | ||
|
||
MistCSS supports creating React, Astro and Hono components. See [frameworks](frameworks). | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters