Add js and css integration

This commit is contained in:
2026-04-23 15:08:45 +02:00
parent 0ee598fbdd
commit cfa72be700
8 changed files with 1595 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
node_modules/
+14 -4
View File
@@ -1,11 +1,21 @@
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY assets/ ./assets/
COPY templates/ ./templates/
# JS bauen
RUN ./node_modules/.bin/esbuild ./assets/javascript/test.js --bundle --outfile=./public/build/app.js --minify
# CSS bauen
RUN ./node_modules/.bin/tailwindcss -i ./assets/css/app.css -o ./public/build/app.css --minify
FROM php:8.3-apache FROM php:8.3-apache
RUN a2enmod rewrite RUN a2enmod rewrite
COPY . /var/www/html COPY . /var/www/html
COPY --from=builder /app/public/build /var/www/html/public/build
RUN sed -i 's|/var/www/html|/var/www/html/public|g' \ RUN sed -i 's|/var/www/html|/var/www/html/public|g' \
/etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf
RUN sed -i 's|AllowOverride None|AllowOverride All|g' \ RUN sed -i 's|AllowOverride None|AllowOverride All|g' \
/etc/apache2/apache2.conf /etc/apache2/apache2.conf
+1
View File
@@ -0,0 +1 @@
@import "tailwindcss";
+11
View File
@@ -0,0 +1,11 @@
const colors = ['#ff6b6b', '#4ecdc4', '#45b7d1', '#96ceb4', '#ffeaa7', '#dda0dd'];
let current = 0;
setInterval(() => {
current = (current + 1) % colors.length;
document.body.style.backgroundColor = colors[current];
}, 1000);
window.test = function(world) {
console.log('Hello, ' + world + '!');
}
+1540
View File
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
{
"name": "pawra",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@git.pawly.dev:cheeseburger/pawra.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"devDependencies": {
"@tailwindcss/cli": "^4.2.4",
"esbuild": "0.28.0",
"tailwindcss": "^4.2.4"
}
}
+4
View File
@@ -5,6 +5,10 @@ ob_start();
<h1><?= htmlspecialchars($title) ?></h1> <h1><?= htmlspecialchars($title) ?></h1>
<p>Willkommen auf meiner Seite!</p> <p>Willkommen auf meiner Seite!</p>
<p class="text-red-500">I am red.</p>
<button onclick="test('World')">Test</button>
<?php <?php
$content = ob_get_clean(); $content = ob_get_clean();
require __DIR__ . '/layout.php'; require __DIR__ . '/layout.php';
+2
View File
@@ -3,6 +3,8 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title><?= htmlspecialchars($title) ?></title> <title><?= htmlspecialchars($title) ?></title>
<link rel="stylesheet" href="/build/app.css">
<script src="/build/app.js" defer></script>
</head> </head>
<body> <body>
<?= $content ?> <?= $content ?>