Add caddy and clean up build
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
:80 {
|
||||||
|
reverse_proxy localhost:5173
|
||||||
|
handle /php/* {
|
||||||
|
reverse_proxy localhost:8000
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>NASLOV</title>
|
||||||
|
|
||||||
|
<script defer type="module" src="/vue/main.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>NASLOV</title>
|
|
||||||
|
|
||||||
<?php if (getenv('DEV')): ?>
|
|
||||||
<script type="module" src="http://localhost:5173/@vite/client"></script>
|
|
||||||
<?php else: ?>
|
|
||||||
<link href='dist/assets/app.css' rel='stylesheet' type='text/css'>
|
|
||||||
<?php endif ?>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
|
|
||||||
<?php if (getenv('DEV')): ?>
|
|
||||||
<script type="module" src="http://localhost:5173/vue/main.js"></script>
|
|
||||||
<?php else: ?>
|
|
||||||
<script type="module" src="dist/app.js"></script>
|
|
||||||
<?php endif ?>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
+2
-4
@@ -3,10 +3,8 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build && cp -R php dist/php",
|
||||||
"build-dev": "vite build --mode development",
|
"serve": "concurrently \"vite\" \"php -S localhost:8000\" \"mailpit\" \"caddy run --config Caddyfile\""
|
||||||
"dev": "vite build --mode development --watch",
|
|
||||||
"serve": "concurrently \"vite\" \"cross-env DEV=1 php -S localhost:8000\" \"mailpit\""
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": "7.3.1",
|
"@fortawesome/fontawesome-free": "7.3.1",
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$notifications = ["Helo1", "hello2"];
|
||||||
|
|
||||||
|
echo json_encode($notifications);
|
||||||
+2
-20
@@ -4,7 +4,7 @@ import vue from '@vitejs/plugin-vue'
|
|||||||
import VueRouter from 'vue-router/vite'
|
import VueRouter from 'vue-router/vite'
|
||||||
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
|
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
|
||||||
|
|
||||||
export default defineConfig(({ mode }) => ({
|
export default defineConfig(() => ({
|
||||||
plugins: [
|
plugins: [
|
||||||
VueI18n({
|
VueI18n({
|
||||||
include: fileURLToPath(new URL('./vue/locales/**', import.meta.url)),
|
include: fileURLToPath(new URL('./vue/locales/**', import.meta.url)),
|
||||||
@@ -15,7 +15,6 @@ export default defineConfig(({ mode }) => ({
|
|||||||
}),
|
}),
|
||||||
vue(),
|
vue(),
|
||||||
],
|
],
|
||||||
base: './',
|
|
||||||
server: {
|
server: {
|
||||||
port: 5173,
|
port: 5173,
|
||||||
strictPort: true,
|
strictPort: true,
|
||||||
@@ -29,24 +28,7 @@ export default defineConfig(({ mode }) => ({
|
|||||||
outDir: 'dist',
|
outDir: 'dist',
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
rolldownOptions: {
|
rolldownOptions: {
|
||||||
input: { app: './vue/main.js' },
|
input: { index: './index.html' },
|
||||||
output: {
|
|
||||||
entryFileNames: 'app.js',
|
|
||||||
manualChunks: undefined,
|
|
||||||
assetFileNames: (asset) => {
|
|
||||||
const name = asset.names?.[0] ?? '';
|
|
||||||
if (name.endsWith('.css')) {
|
|
||||||
return 'assets/app.css';
|
|
||||||
}
|
}
|
||||||
return 'assets/[name]-[hash][extname]';
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
define: {
|
|
||||||
__VUE_PROD_DEVTOOLS__: mode === 'development' ? 'true' : 'false'
|
|
||||||
},
|
|
||||||
esbuild: {
|
|
||||||
drop: mode === 'development' ? [] : ['console', 'debugger']
|
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|||||||
+6
-2
@@ -1,13 +1,17 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<LanguageSwitcher />
|
<LanguageSwitcher />
|
||||||
|
<p>
|
||||||
{{ t('app.hello') }}
|
{{ t('app.hello') }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<Suspense>
|
||||||
<RouterView />
|
<RouterView />
|
||||||
|
</Suspense>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import LanguageSwitcher from '@/components/LanguageSwitcher.vue'
|
import LanguageSwitcher from '@/components/LanguageSwitcher.vue'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n();
|
||||||
</script>
|
</script>
|
||||||
+1
-1
@@ -13,7 +13,7 @@ const loadedLocales = new Set()
|
|||||||
|
|
||||||
async function loadLocaleMessages(locale) {
|
async function loadLocaleMessages(locale) {
|
||||||
if (!loadedLocales.has(locale)) {
|
if (!loadedLocales.has(locale)) {
|
||||||
const messages = await import(`../locales/${locale}.json`)
|
const messages = await import(`./locales/${locale}.json`)
|
||||||
i18n.global.setLocaleMessage(locale, messages.default)
|
i18n.global.setLocaleMessage(locale, messages.default)
|
||||||
loadedLocales.add(locale)
|
loadedLocales.add(locale)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
{{ t('app.world') }}
|
<p>{{ t('app.world') }}</p>
|
||||||
|
<p v-for="value in j">
|
||||||
|
{{ value }}
|
||||||
|
</p>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const res = await fetch("/php/notifications.php")
|
||||||
|
const j = await res.json();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Reference in New Issue
Block a user