|
1 | | -# vue-tres-starter |
| 1 | +# Vue 3 + TresJS starter |
2 | 2 |
|
3 | | -This template should help get you started developing with Vue 3 in Vite. |
| 3 | + |
4 | 4 |
|
5 | | -## Recommended IDE Setup |
| 5 | +## What's included |
6 | 6 |
|
7 | | -[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). |
| 7 | +### 1. Demo GLTF model |
8 | 8 |
|
9 | | -## Customize configuration |
| 9 | +The `<Suzanne />` component in `/components/Suzanne` loads a custom GLTF model and uses a custom `ShaderMaterial`. |
10 | 10 |
|
11 | | -See [Vite Configuration Reference](https://vitejs.dev/config/). |
| 11 | +### 2. Box with click handler |
12 | 12 |
|
13 | | -## Project Setup |
| 13 | +The `<SampleBox />` component rotates and floats on every tick and has click/hover handlers. |
14 | 14 |
|
15 | | -```sh |
| 15 | +### 3. GSAP as a Vue Composable |
| 16 | + |
| 17 | +GSAP is included as a composable and can be included in any component the following way: |
| 18 | + |
| 19 | +```js |
| 20 | +import { useGSAP } from '@/composables/useGSAP' |
| 21 | + |
| 22 | +const { gsap } = useGSAP() |
| 23 | +``` |
| 24 | + |
| 25 | +The composable file is located in `/src//composables/useGSAP.js`. |
| 26 | + |
| 27 | +### 4. Pinia |
| 28 | + |
| 29 | +[Pinia](https://pinia.vuejs.org/) is already included and configured. |
| 30 | + |
| 31 | +The states are stored in the `/src//stores` folder. |
| 32 | + |
| 33 | +## Setup |
| 34 | + |
| 35 | +Make sure to install the dependencies: |
| 36 | + |
| 37 | +```bash |
| 38 | +# yarn |
| 39 | +yarn install |
| 40 | + |
| 41 | +# npm |
| 42 | +npm install |
| 43 | + |
| 44 | +# pnpm |
16 | 45 | pnpm install |
17 | 46 | ``` |
18 | 47 |
|
19 | | -### Compile and Hot-Reload for Development |
| 48 | +## Development Server |
| 49 | + |
| 50 | +Start the development server on `http://localhost:3000` |
| 51 | + |
| 52 | +```bash |
| 53 | +# yarn |
| 54 | +yarn dev |
| 55 | + |
| 56 | +# npm |
| 57 | +npm run dev |
20 | 58 |
|
21 | | -```sh |
22 | | -pnpm dev |
| 59 | +# pnpm |
| 60 | +pnpm run dev |
23 | 61 | ``` |
24 | 62 |
|
25 | | -### Compile and Minify for Production |
| 63 | +## Production |
26 | 64 |
|
27 | | -```sh |
28 | | -pnpm build |
| 65 | +Build the application for production: |
| 66 | + |
| 67 | +```bash |
| 68 | +# yarn |
| 69 | +yarn build |
| 70 | + |
| 71 | +# npm |
| 72 | +npm run build |
| 73 | + |
| 74 | +# pnpm |
| 75 | +pnpm run build |
29 | 76 | ``` |
30 | 77 |
|
31 | | -### Lint with [ESLint](https://eslint.org/) |
| 78 | +Locally preview production build: |
| 79 | + |
| 80 | +```bash |
| 81 | +# yarn |
| 82 | +yarn preview |
| 83 | + |
| 84 | +# npm |
| 85 | +npm run preview |
32 | 86 |
|
33 | | -```sh |
34 | | -pnpm lint |
| 87 | +# pnpm |
| 88 | +pnpm run preview |
35 | 89 | ``` |
0 commit comments