Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed May 4, 2024
1 parent 5acd4b7 commit eecc1ed
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ https://typicode.github.io/mistcss

## Supports

Bring your favorite tools:

- [Next.js](https://nextjs.org/)
- [Remix](https://remix.run/)
- [React](https://react.dev/)
Expand Down
16 changes: 11 additions & 5 deletions docs/src/content/docs/integration/frameworks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@
title: Frameworks
---

## React

By default, `mistcss` will generate React components that you can use in Next.js or Remix

## React

```sh
mistcss ./components
```

## Hono
## Vue

```sh
mistcss ./components --target=hono
mistcss ./components --target=vue
```

## Astro

```sh
mistcss ./components --target=astro
```
```

## Hono

```sh
mistcss ./components --target=hono
```
6 changes: 4 additions & 2 deletions docs/src/content/docs/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ Unlike other tools, __MistCSS doesn't modify your CSS__, leaving you free to __u

As a consequence, __you don't have to learn a new API__ to start using it nor have to install a code editor extension. __It's just CSS__.

Bring your favorite tools:
Supports:

- [Next.js](https://nextjs.org/)
- [Remix](https://remix.run/)
- [React](https://react.dev/)
- [Vue](https://vuejs.org)
- [Astro](https://astro.build/)
- [Hono](https://hono.dev/)
- [Tailwind CSS](https://tailwindcss.com/)
- [Tailwind CSS](https://tailwindcss.com/)

__Bonus__: if you need to switch from one framework to another, you won't have to rewrite your components. Simply change MistCSS compilation target.
14 changes: 11 additions & 3 deletions src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import { globby } from 'globby'
import { parse } from './parser.js'
import { render as reactRender } from './renderers/react.js'
import { render as astroRender } from './renderers/astro.js'
import { render as vueRender } from './renderers/vue.js'

type Extension = '.tsx' | '.astro'
type Target = 'react' | 'hono' | 'astro';
type Target = 'react' | 'hono' | 'astro' | 'vue';

function createFile(mist: string, target: Target, ext: Extension) {
try {
Expand All @@ -30,6 +31,9 @@ function createFile(mist: string, target: Target, ext: Extension) {
case 'astro':
result = astroRender(name, data[0])
break
case 'vue':
result = vueRender(name, data[0])
break
}
fs.writeFileSync(mist.replace(/\.css$/, ext), result)
}
Expand All @@ -46,7 +50,7 @@ function createFile(mist: string, target: Target, ext: Extension) {
function usage() {
console.log(`Usage: mistcss <directory> [options]
--watch, -w Watch for changes
--target, -t Render target (react, hono, astro) [default: react]
--target, -t Render target (react, vue, astro, hono) [default: react]
`)
}

Expand Down Expand Up @@ -81,7 +85,7 @@ if (!(await fsPromises.stat(dir)).isDirectory()) {
}

const { target } = values;
if (target !== 'react' && target !== 'hono' && target !== 'astro') {
if (target !== 'react' && target !== 'hono' && target !== 'astro' && target !== 'vue') {
console.error('Invalid render option')
usage()
process.exit(1)
Expand All @@ -102,6 +106,10 @@ switch (target) {
ext = '.astro'
console.log('Rendering Astro components')
break
case 'vue':
ext = '.tsx'
console.log('Rendering Vue components')
break
default:
console.error('Invalid target option')
usage()
Expand Down

0 comments on commit eecc1ed

Please sign in to comment.