Skip to content

Commit b6765fc

Browse files
committed
init
0 parents  commit b6765fc

27 files changed

+612
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# reusethis
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
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).
8+
9+
## Type Support for `.vue` Imports in TS
10+
11+
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
12+
13+
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14+
15+
1. Disable the built-in TypeScript Extension
16+
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17+
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18+
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
19+
20+
## Customize configuration
21+
22+
See [Vite Configuration Reference](https://vitejs.dev/config/).
23+
24+
## Project Setup
25+
26+
```sh
27+
npm install
28+
```
29+
30+
### Compile and Hot-Reload for Development
31+
32+
```sh
33+
npm run dev
34+
```
35+
36+
### Type-Check, Compile and Minify for Production
37+
38+
```sh
39+
npm run build
40+
```
41+
42+
### Run Unit Tests with [Vitest](https://vitest.dev/)
43+
44+
```sh
45+
npm run test:unit
46+
```

env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>

package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "reusethis",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "vite",
7+
"build": "run-p type-check build-only",
8+
"preview": "vite preview",
9+
"test:unit": "vitest",
10+
"build-only": "vite build",
11+
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false"
12+
},
13+
"dependencies": {
14+
"pinia": "^2.0.32",
15+
"vue": "^3.2.47"
16+
},
17+
"devDependencies": {
18+
"@types/jsdom": "^21.1.0",
19+
"@types/node": "^18.14.2",
20+
"@vitejs/plugin-vue": "^4.0.0",
21+
"@vue/test-utils": "^2.3.0",
22+
"@vue/tsconfig": "^0.1.3",
23+
"jsdom": "^21.1.0",
24+
"npm-run-all": "^4.1.5",
25+
"typescript": "~4.8.4",
26+
"vite": "^4.1.4",
27+
"vitest": "^0.29.1",
28+
"vue-tsc": "^1.2.0"
29+
}
30+
}

public/favicon.ico

4.19 KB
Binary file not shown.

src/App.vue

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<script setup lang="ts">
2+
import HelloWorld from './components/HelloWorld.vue'
3+
import TheWelcome from './components/TheWelcome.vue'
4+
</script>
5+
6+
<template>
7+
<header>
8+
<img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />
9+
10+
<div class="wrapper">
11+
<HelloWorld msg="You did it!" />
12+
</div>
13+
</header>
14+
15+
<main>
16+
<TheWelcome />
17+
</main>
18+
</template>
19+
20+
<style scoped>
21+
header {
22+
line-height: 1.5;
23+
}
24+
25+
.logo {
26+
display: block;
27+
margin: 0 auto 2rem;
28+
}
29+
30+
@media (min-width: 1024px) {
31+
header {
32+
display: flex;
33+
place-items: center;
34+
padding-right: calc(var(--section-gap) / 2);
35+
}
36+
37+
.logo {
38+
margin: 0 2rem 0 0;
39+
}
40+
41+
header .wrapper {
42+
display: flex;
43+
place-items: flex-start;
44+
flex-wrap: wrap;
45+
}
46+
}
47+
</style>

src/assets/base.css

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* color palette from <https://github.com/vuejs/theme> */
2+
:root {
3+
--vt-c-white: #ffffff;
4+
--vt-c-white-soft: #f8f8f8;
5+
--vt-c-white-mute: #f2f2f2;
6+
7+
--vt-c-black: #181818;
8+
--vt-c-black-soft: #222222;
9+
--vt-c-black-mute: #282828;
10+
11+
--vt-c-indigo: #2c3e50;
12+
13+
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
14+
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
15+
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
16+
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
17+
18+
--vt-c-text-light-1: var(--vt-c-indigo);
19+
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
20+
--vt-c-text-dark-1: var(--vt-c-white);
21+
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
22+
}
23+
24+
/* semantic color variables for this project */
25+
:root {
26+
--color-background: var(--vt-c-white);
27+
--color-background-soft: var(--vt-c-white-soft);
28+
--color-background-mute: var(--vt-c-white-mute);
29+
30+
--color-border: var(--vt-c-divider-light-2);
31+
--color-border-hover: var(--vt-c-divider-light-1);
32+
33+
--color-heading: var(--vt-c-text-light-1);
34+
--color-text: var(--vt-c-text-light-1);
35+
36+
--section-gap: 160px;
37+
}
38+
39+
@media (prefers-color-scheme: dark) {
40+
:root {
41+
--color-background: var(--vt-c-black);
42+
--color-background-soft: var(--vt-c-black-soft);
43+
--color-background-mute: var(--vt-c-black-mute);
44+
45+
--color-border: var(--vt-c-divider-dark-2);
46+
--color-border-hover: var(--vt-c-divider-dark-1);
47+
48+
--color-heading: var(--vt-c-text-dark-1);
49+
--color-text: var(--vt-c-text-dark-2);
50+
}
51+
}
52+
53+
*,
54+
*::before,
55+
*::after {
56+
box-sizing: border-box;
57+
margin: 0;
58+
position: relative;
59+
font-weight: normal;
60+
}
61+
62+
body {
63+
min-height: 100vh;
64+
color: var(--color-text);
65+
background: var(--color-background);
66+
transition: color 0.5s, background-color 0.5s;
67+
line-height: 1.6;
68+
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
69+
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
70+
font-size: 15px;
71+
text-rendering: optimizeLegibility;
72+
-webkit-font-smoothing: antialiased;
73+
-moz-osx-font-smoothing: grayscale;
74+
}

src/assets/logo.svg

Lines changed: 1 addition & 0 deletions
Loading

src/assets/main.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@import './base.css';
2+
3+
#app {
4+
max-width: 1280px;
5+
margin: 0 auto;
6+
padding: 2rem;
7+
8+
font-weight: normal;
9+
}
10+
11+
a,
12+
.green {
13+
text-decoration: none;
14+
color: hsla(160, 100%, 37%, 1);
15+
transition: 0.4s;
16+
}
17+
18+
@media (hover: hover) {
19+
a:hover {
20+
background-color: hsla(160, 100%, 37%, 0.2);
21+
}
22+
}
23+
24+
@media (min-width: 1024px) {
25+
body {
26+
display: flex;
27+
place-items: center;
28+
}
29+
30+
#app {
31+
display: grid;
32+
grid-template-columns: 1fr 1fr;
33+
padding: 0 2rem;
34+
}
35+
}

src/components/HelloWorld.vue

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script setup lang="ts">
2+
defineProps<{
3+
msg: string
4+
}>()
5+
</script>
6+
7+
<template>
8+
<div class="greetings">
9+
<h1 class="green">{{ msg }}</h1>
10+
<h3>
11+
You’ve successfully created a project with
12+
<a href="https://vitejs.dev/" target="_blank" rel="noopener">Vite</a> +
13+
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>.
14+
</h3>
15+
</div>
16+
</template>
17+
18+
<style scoped>
19+
h1 {
20+
font-weight: 500;
21+
font-size: 2.6rem;
22+
top: -10px;
23+
}
24+
25+
h3 {
26+
font-size: 1.2rem;
27+
}
28+
29+
.greetings h1,
30+
.greetings h3 {
31+
text-align: center;
32+
}
33+
34+
@media (min-width: 1024px) {
35+
.greetings h1,
36+
.greetings h3 {
37+
text-align: left;
38+
}
39+
}
40+
</style>

src/components/TheWelcome.vue

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<script setup lang="ts">
2+
import WelcomeItem from './WelcomeItem.vue'
3+
import DocumentationIcon from './icons/IconDocumentation.vue'
4+
import ToolingIcon from './icons/IconTooling.vue'
5+
import EcosystemIcon from './icons/IconEcosystem.vue'
6+
import CommunityIcon from './icons/IconCommunity.vue'
7+
import SupportIcon from './icons/IconSupport.vue'
8+
</script>
9+
10+
<template>
11+
<WelcomeItem>
12+
<template #icon>
13+
<DocumentationIcon />
14+
</template>
15+
<template #heading>Documentation</template>
16+
17+
Vue’s
18+
<a href="https://vuejs.org/" target="_blank" rel="noopener">official documentation</a>
19+
provides you with all information you need to get started.
20+
</WelcomeItem>
21+
22+
<WelcomeItem>
23+
<template #icon>
24+
<ToolingIcon />
25+
</template>
26+
<template #heading>Tooling</template>
27+
28+
This project is served and bundled with
29+
<a href="https://vitejs.dev/guide/features.html" target="_blank" rel="noopener">Vite</a>. The
30+
recommended IDE setup is
31+
<a href="https://code.visualstudio.com/" target="_blank" rel="noopener">VSCode</a> +
32+
<a href="https://github.com/johnsoncodehk/volar" target="_blank" rel="noopener">Volar</a>. If
33+
you need to test your components and web pages, check out
34+
<a href="https://www.cypress.io/" target="_blank" rel="noopener">Cypress</a> and
35+
<a href="https://on.cypress.io/component" target="_blank">Cypress Component Testing</a>.
36+
37+
<br />
38+
39+
More instructions are available in <code>README.md</code>.
40+
</WelcomeItem>
41+
42+
<WelcomeItem>
43+
<template #icon>
44+
<EcosystemIcon />
45+
</template>
46+
<template #heading>Ecosystem</template>
47+
48+
Get official tools and libraries for your project:
49+
<a href="https://pinia.vuejs.org/" target="_blank" rel="noopener">Pinia</a>,
50+
<a href="https://router.vuejs.org/" target="_blank" rel="noopener">Vue Router</a>,
51+
<a href="https://test-utils.vuejs.org/" target="_blank" rel="noopener">Vue Test Utils</a>, and
52+
<a href="https://github.com/vuejs/devtools" target="_blank" rel="noopener">Vue Dev Tools</a>. If
53+
you need more resources, we suggest paying
54+
<a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">Awesome Vue</a>
55+
a visit.
56+
</WelcomeItem>
57+
58+
<WelcomeItem>
59+
<template #icon>
60+
<CommunityIcon />
61+
</template>
62+
<template #heading>Community</template>
63+
64+
Got stuck? Ask your question on
65+
<a href="https://chat.vuejs.org" target="_blank" rel="noopener">Vue Land</a>, our official
66+
Discord server, or
67+
<a href="https://stackoverflow.com/questions/tagged/vue.js" target="_blank" rel="noopener"
68+
>StackOverflow</a
69+
>. You should also subscribe to
70+
<a href="https://news.vuejs.org" target="_blank" rel="noopener">our mailing list</a> and follow
71+
the official
72+
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener">@vuejs</a>
73+
twitter account for latest news in the Vue world.
74+
</WelcomeItem>
75+
76+
<WelcomeItem>
77+
<template #icon>
78+
<SupportIcon />
79+
</template>
80+
<template #heading>Support Vue</template>
81+
82+
As an independent project, Vue relies on community backing for its sustainability. You can help
83+
us by
84+
<a href="https://vuejs.org/sponsor/" target="_blank" rel="noopener">becoming a sponsor</a>.
85+
</WelcomeItem>
86+
</template>

0 commit comments

Comments
 (0)