[TASK] add frontend process and basic files

This commit is contained in:
Marie Birner 2023-04-05 19:33:31 +02:00
parent 59b93e6a06
commit 602da85abe
9 changed files with 1704 additions and 4 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@ target/
db.sqlite db.sqlite
.history/ .history/
Rocket.toml Rocket.toml
static/*
frontend/node_modules/*

1
frontend/main.ts Normal file
View File

@ -0,0 +1 @@
import './scss/app.scss'

1615
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

21
frontend/package.json Normal file
View File

@ -0,0 +1,21 @@
{
"name": "liwest",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"watch": "vite build --emptyOutDir --watch",
"build": "tsc && vite build --emptyOutDir",
"preview": "vite preview"
},
"devDependencies": {
"sass": "^1.60.0",
"typescript": "^4.9.3",
"vite": "^4.2.0",
"vite-plugin-static-copy": "^0.13.1"
},
"dependencies": {
"@popperjs/core": "^2.11.7",
"bootstrap": "^5.2.3"
}
}

3
frontend/scss/app.scss Normal file
View File

@ -0,0 +1,3 @@
body {
background: red;
}

18
frontend/tsconfig.json Normal file
View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM"],
"moduleResolution": "Node",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
}
}

34
frontend/vite.config.js Normal file
View File

@ -0,0 +1,34 @@
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy'
export default defineConfig({
plugins: [
viteStaticCopy({
targets: [
{
src: './static/[!.]*',
dest: './',
},
],
})
],
publicDir: false, // disable copy `public/` to outDir
build: {
rollupOptions: {
input: {
main: './main.ts',
// Example for more entry points
// test: './src/test.ts',
},
output: {
entryFileNames: '[name].js',
assetFileNames: '[name].css',
},
},
manifest: true, // generate manifest.json in outDir
outDir: '../static/',
},
css: {
devSourcemap: true, // disabled by default because of performance reasons
},
})

View File

@ -1,3 +1,7 @@
{% extends "base" %}
{% block content %}
{% if flash %} {% if flash %}
{% if flash.0 == "success" %} {% if flash.0 == "success" %}
<div class="row"> <div class="row">
@ -24,3 +28,6 @@
<button type="submit">Login</button> <button type="submit">Login</button>
</form> </form>
{% endblock content %}

View File

@ -1,12 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="de">
<head> <head>
<link rel="manifest" href="public/manifest.json" />
<link rel="stylesheet" href="/public/main.css">
</head> </head>
<body> <body>
{% block content %} {% block content %}
{% endblock content %} {% endblock content %}