feat: optimize the front-end project page template

This commit is contained in:
misitebao 2022-03-23 21:46:26 +08:00
parent 9442e3e456
commit fe54ccf7d6
9 changed files with 39 additions and 36 deletions

View File

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{.ProjectName}}</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

View File

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{.ProjectName}}</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@ -5,8 +5,7 @@
"description": "A Wails Template", "description": "A Wails Template",
"main": "", "main": "",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1"
"postinstall": "((cp -f index.js.html packages/javascript/index.html) & (cp -f index.ts.html packages/typescript/index.html))& rm -rf *.html"
}, },
"author": "{{.AuthorName}}", "author": "{{.AuthorName}}",
"license": "MIT", "license": "MIT",

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title> <title><%- title %></title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -15,6 +15,7 @@
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^1.10.2", "@vitejs/plugin-vue": "^1.10.2",
"sass": "^1.49.9", "sass": "^1.49.9",
"vite": "^2.8.6" "vite": "^2.8.6",
"vite-plugin-html": "^3.2.0"
} }
} }

View File

@ -2,16 +2,30 @@ import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue"; import vue from "@vitejs/plugin-vue";
import path from "path"; import path from "path";
import pkg from "../../package.json";
import { createHtmlPlugin } from "vite-plugin-html";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [
vue(),
createHtmlPlugin({
minify: false,
// entry: "src/main.js",
template: "index.html",
inject: {
data: {
title: `${pkg.name}`,
},
},
}),
],
resolve: { resolve: {
alias: { alias: {
"@": path.resolve(__dirname, "src"), "@": path.resolve(__dirname, "src"),
}, },
}, },
build: { build: {
outDir:"../../dist", outDir: "../../dist",
rollupOptions: { rollupOptions: {
output: { output: {
entryFileNames: `assets/[name].js`, entryFileNames: `assets/[name].js`,

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title> <title><%- title %></title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -17,6 +17,7 @@
"sass": "^1.49.9", "sass": "^1.49.9",
"typescript": "^4.4.4", "typescript": "^4.4.4",
"vite": "^2.8.6", "vite": "^2.8.6",
"vue-tsc": "^0.28.10" "vue-tsc": "^0.28.10",
"vite-plugin-html": "^3.2.0"
} }
} }

View File

@ -2,16 +2,30 @@ import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue"; import vue from "@vitejs/plugin-vue";
import path from "path"; import path from "path";
import pkg from "../../package.json";
import { createHtmlPlugin } from "vite-plugin-html";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [
vue(),
createHtmlPlugin({
minify: false,
// entry: "src/main.js",
template: "index.html",
inject: {
data: {
title: `${pkg.name}`,
},
},
}),
],
resolve: { resolve: {
alias: { alias: {
"@": path.resolve(__dirname, "src"), "@": path.resolve(__dirname, "src"),
}, },
}, },
build: { build: {
outDir:"../../dist", outDir: "../../dist",
rollupOptions: { rollupOptions: {
output: { output: {
entryFileNames: `assets/[name].js`, entryFileNames: `assets/[name].js`,