Skip to content

Commit

Permalink
📝 Add Vanilla Extract setup document
Browse files Browse the repository at this point in the history
  • Loading branch information
kiliman committed Dec 7, 2023
1 parent 10f7372 commit b82541b
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions docs/setup/vanilla-extract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Vanilla Extract Setup

Vanilla Extract is a library to create zero-runtime stylesheets in TypeScript

https://vanilla-extract.style/

### Packages

The following packages are added:

- `@vanilla-extract/css`

The following _dev_ packages are added:

- `@vanilla-extract/vite-plugin`

### Configuration

The following configuration files are used:

- vite.config.js

```diff
+ import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'

export default defineConfig({
plugins: [
+ vanillaExtractPlugin(),
morganPlugin(),
remix(remixConfig),
tsconfigPaths(),
],
})
```

Import the `vanillaExtractPlugin` and add it to your vite `plugins`

### Usage

Create a collocated _route.tsx_ and _route.css.ts_ file.

```ts
// routes/vanilla/route.tsx
import * as styles from './route.css'

export default function Component() {
return (
<div className={styles.container}>
Hello Vanilla Extract!
</div>
)
}

```

```ts
// routes/vanilla/route.css.ts
import { style } from '@vanilla-extract/css'

export const container = style({
backgroundColor: `lightblue`,
padding: `2rem`,
})
```

0 comments on commit b82541b

Please sign in to comment.