cms setup

This commit is contained in:
Ludvík Prokopec 2022-12-03 22:35:28 +01:00
parent 4c3dca84eb
commit a137a9bd5a
23 changed files with 115 additions and 30 deletions

8
cms/cms.js Normal file
View File

@ -0,0 +1,8 @@
import '../src/app.css'
import Cms from './cms.svelte'
const cms = new Cms({
target: document.getElementById('cms')
})
export default cms

24
cms/cms.svelte Normal file
View File

@ -0,0 +1,24 @@
<script lang="ts">
import '$src/main.scss'
import { i18n, isLoading } from './locales/i18n'
import { Router, Route } from '$lib/router'
import Index from './routes/index.svelte'
/** init i18n */
i18n()
/** register service worker */
if ('serviceWorker' in window.navigator) {
window.navigator.serviceWorker.register('/serviceworker.js', {
scope: '/',
})
}
</script>
<main>
{#if !$isLoading}
<Router basepath="/cms">
<Route path="/" component={Index} />
</Router>
{/if}
</main>

10
cms/components.ts Normal file
View File

@ -0,0 +1,10 @@
import FileDrop from './components/FileDrop.svelte'
import Input from './components/Input.svelte'
import Sortable from './components/Sortable.svelte'
import BlockQuote from './components/BlockQuote.svelte'
import MarkdownEditor from './components/MarkdownEditor.svelte'
import MarkdownRenderer from './components/MarkdownRenderer.svelte'
import { Radio, Checkbox, Fileupload as FileUpload, Range, Select, Textarea, Toggle, Hr as HorizontalRule, Button, ButtonGroup } from 'flowbite-svelte'
export { FileDrop, Input, Radio, Checkbox, FileUpload, Range, Select, Textarea, Toggle, Sortable, BlockQuote, HorizontalRule, MarkdownEditor, MarkdownRenderer, Button, ButtonGroup }

16
cms/index.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CMS</title>
</head>
<body>
<div id="cms"></div>
<script type="module" src="cms.js"></script>
</body>
</html>

7
cms/locales/cs.json Normal file
View File

@ -0,0 +1,7 @@
{
"page": {
"home": {
"title": "Domovská stránka"
}
}
}

7
cms/locales/en.json Normal file
View File

@ -0,0 +1,7 @@
{
"page": {
"home": {
"title": "Homepage"
}
}
}

11
cms/locales/i18n.ts Normal file
View File

@ -0,0 +1,11 @@
import { register, init, getLocaleFromNavigator, isLoading, locale, locales } from 'svelte-i18n'
register('en', () => import('./en.json'))
register('cs', () => import('./cs.json'))
export const i18n = () => init({
fallbackLocale: 'en',
initialLocale: getLocaleFromNavigator(),
})
export { isLoading, locale, locales }

0
cms/routes/index.svelte Normal file
View File

View File

@ -1,13 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Svelte</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Svelte + Appwrite</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

View File

@ -1,6 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

0
public/nginx.conf Normal file
View File

View File

@ -1,10 +0,0 @@
import FileDrop from './FileDrop.svelte'
import Input from './Input.svelte'
import Sortable from './Sortable.svelte'
import BlockQuote from './BlockQuote.svelte'
import MarkdownEditor from './MarkdownEditor.svelte'
import MarkdownRenderer from './MarkdownRenderer.svelte'
import { Radio, Checkbox, Fileupload as FileUpload, Range, Select, Textarea, Toggle, Hr as HorizontalRule, Button, ButtonGroup } from 'flowbite-svelte'
export { FileDrop, Input, Radio, Checkbox, FileUpload, Range, Select, Textarea, Toggle, Sortable, BlockQuote, HorizontalRule, MarkdownEditor, MarkdownRenderer, Button, ButtonGroup }

View File

@ -2,13 +2,14 @@
module.exports = {
content: [
'./src/**/*.{html,js,svelte,ts}',
'./cms/**/*.{html,js,svelte,ts}',
'./node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}',
],
theme: {
extend: {}
},
plugins: [
require('flowbite/plugin')
//require('flowbite/plugin')
],
darkMode: 'class'
}

View File

@ -14,11 +14,11 @@
"$root/*": [
"./*"
],
"$scr/*": [
"./scr/*"
"$src/*": [
"./src/*"
],
"$cms/*": [
"./scr/cms/*"
"./cms/*"
],
},
}

View File

@ -10,7 +10,7 @@ export default defineConfig({
'$lib': path.resolve(__dirname, 'src', 'lib'),
'$root': path.resolve(__dirname),
'$src': path.resolve(__dirname, 'src'),
'$cms': path.resolve(__dirname, 'src', 'cms')
'$cms': path.resolve(__dirname, 'cms')
}
},
plugins: [
@ -20,5 +20,13 @@ export default defineConfig({
postcss: true
})
})
]
],
build: {
rollupOptions: {
input: {
app: path.resolve(__dirname, 'index.html'),
cms: path.resolve(__dirname, 'cms', 'index.html')
}
}
}
})