Skip to content

Commit 6719554

Browse files
committed
chore: add example project
1 parent c7b0fa1 commit 6719554

File tree

19 files changed

+1287
-15
lines changed

19 files changed

+1287
-15
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,37 @@ A Vite plugin for Vue.js that allows dynamic template selection at build time.
44

55
## Usage
66

7+
### Install the plugin
8+
9+
```bash
10+
# Using npm
11+
npm install vite-plugin-vue-template-selector --save-dev
12+
13+
# Using yarn
14+
yarn add vite-plugin-vue-template-selector --dev
15+
16+
# Using pnpm
17+
pnpm add vite-plugin-vue-template-selector --save-dev
18+
```
19+
720
### Select a template by name
821

922
```ts
1023
// vite.config.ts
24+
import vue from "@vitejs/plugin-vue";
25+
import { defineConfig } from "vite";
1126
import vueTemplateSelector from "vite-plugin-vue-template-selector";
1227

13-
export default {
28+
// https://vite.dev/config/
29+
export default defineConfig({
1430
plugins: [
31+
// NOTE: The order of plugins matters. Ensure this plugin is before the Vue plugin.
1532
vueTemplateSelector({
1633
name: "default",
1734
}),
35+
vue(),
1836
],
19-
};
37+
});
2038
```
2139

2240
### Create multiple templates

example/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

example/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Vue 3 + TypeScript + Vite
2+
3+
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4+
5+
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).

example/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" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + Vue + TS</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>

example/package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "example",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "vue-tsc -b && vite build",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"vue": "^3.5.17"
13+
},
14+
"devDependencies": {
15+
"@vitejs/plugin-vue": "^6.0.0",
16+
"@vue/tsconfig": "^0.7.0",
17+
"typescript": "~5.8.3",
18+
"vite": "^7.0.4",
19+
"vite-plugin-vue-template-selector": "file:../",
20+
"vue-tsc": "^3.0.3"
21+
}
22+
}

0 commit comments

Comments
 (0)