Skip to content

Commit

Permalink
Use package.json fields in title/desc tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinovantes committed Jun 24, 2024
1 parent a4aa11e commit d9d4033
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RST Compiler</title>
<title>%PROJECT_TITLE%</title>
<meta name="description" content="%PROJECT_DESC%">
</head>
<body>
<div id="app"></div>
Expand Down
6 changes: 6 additions & 0 deletions vite.config.demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import vue from '@vitejs/plugin-vue'
import path from 'node:path'
import { quasar, transformAssetUrls } from '@quasar/vite-plugin'
import { commonConfig } from './vite.config.js'
import packageJson from './package.json'

export default mergeConfig(commonConfig, defineConfig({
root: path.resolve(__dirname, './demo'),
Expand All @@ -12,6 +13,11 @@ export default mergeConfig(commonConfig, defineConfig({
port: 8080,
},

define: {
'import.meta.env.PROJECT_TITLE': JSON.stringify(packageJson.name),
'import.meta.env.PROJECT_DESC': JSON.stringify(packageJson.description),
},

plugins: [
vue({
template: {
Expand Down

0 comments on commit d9d4033

Please sign in to comment.