Skip to content

Commit 9254b88

Browse files
committed
how to use trunx with Vite
1 parent 03cf073 commit 9254b88

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
**ToC**
66

77
- [Installation](#installation)
8+
- [How to](#how-to)
9+
- [use trunx with Vite](#use-trunx-with-vite)
810
- API:
911
- [React components](#react-components)
1012
- [Components list](#components-list)
@@ -22,6 +24,38 @@ npm install trunx
2224

2325
Notice that you should also have React installed, minimum version supported is 17 (the transpiled code uses `react/jsx-runtime`). However it is not listed as a peer dependency, you may also use _trunx_ without _React_.
2426

27+
## How to
28+
29+
### use trunx with Vite
30+
31+
Assuming you have a [Vite](https://vitejs.dev/) project with React and TypeScript, of course first of all install `trunx`; it will also install latest `bulma`.
32+
33+
Then create a `src/main.scss`, you can start with something like this:
34+
35+
```scss
36+
// Load Bulma's base styles and themes (including the minireset)
37+
@use "bulma/sass/base";
38+
@use "bulma/sass/themes";
39+
40+
// Load other Bulma components
41+
@use "bulma/sass/elements/button";
42+
@use "bulma/sass/components/message";
43+
```
44+
45+
Import it in your entry file, e.g. `src/main.tsx`, with something like `import "./main.scss"` and you are done.
46+
47+
Try it out! Import `trunx` to your `src/App.tsx`:
48+
49+
```tsx
50+
import { Button } from "trunx"
51+
```
52+
53+
Add a `Button` in the JSX like this:
54+
55+
```tsx
56+
<Button color="primary">Hello trunx</Button>
57+
```
58+
2559
## API
2660

2761
### React components

0 commit comments

Comments
 (0)