Skip to content

Commit

Permalink
Update configuration. Add project name var to index title
Browse files Browse the repository at this point in the history
  • Loading branch information
José Luis Pereira committed Jul 15, 2022
1 parent e653ea3 commit 4872836
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TaxonWorks public page. (Vite prototype)</title>
<title><%- project_name %></title>
</head>
<body>
<div id="app"></div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Autocomplete/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
dark:text-white
dark:border-slate-700
border-gray-300
dark:placeholder:text-white
dark:placeholder:text-slate-400
focus:ring-primary-500
focus:border-primary-500"
:placeholder="placeholder"
Expand Down
11 changes: 11 additions & 0 deletions src/plugins/htmlPlugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default (data) => ({
name: 'html-transform',
transformIndexHtml: {
enforce: 'pre',
transform: (html) => {
return html.replace(/<%-(.*?)%>/g, (_, p1) =>
data[p1.trim()] || ''
)
}
}
})
16 changes: 8 additions & 8 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { defineConfig, loadEnv } from 'vite'
import { loadConfiguration } from './src/utils/loadConfiguration.js'
import path from 'path'
import htmlPlugin from './src/plugins/htmlPlugin.js'
import Vue from '@vitejs/plugin-vue'
import Markdown from 'vite-plugin-md'
import path from 'path'
import Pages from 'vite-plugin-pages'
import Content from '@originjs/vite-plugin-content'

export default ({ mode }) => {
const { VITE_BASE_URL } = loadEnv(mode, process.cwd())
export default () => {
const configuration = loadConfiguration(__dirname)

return defineConfig({
base: VITE_BASE_URL,
base: configuration.base_url,
define: {
__APP_ENV__: loadConfiguration(__dirname),
__APP_ENV__: configuration,
__APP_PATH__: () => __dirname
},
resolve: {
Expand All @@ -24,7 +24,6 @@ export default ({ mode }) => {
Vue({
include: [/\.vue$/, /\.md$/]
}),
Content(),
Markdown(),
Pages({
dirs: 'pages',
Expand All @@ -37,7 +36,8 @@ export default ({ mode }) => {
return route
}
}
})
}),
htmlPlugin(configuration)
],
})
}

0 comments on commit 4872836

Please sign in to comment.