Compare commits

..

2 Commits

Author SHA1 Message Date
fee3c9ece1 Merge branch 'main' of https://git.pontusmail.org/aidan/pontus
All checks were successful
Minify HTML and CSS / minify (push) Successful in 8s
2025-01-26 02:16:24 -05:00
db01f1957c add minification for HTML and CSS, update links to minified files, and remove obsolete script 2025-01-26 02:15:02 -05:00
6 changed files with 42 additions and 62 deletions

View File

@ -27,11 +27,11 @@ jobs:
- name: Minify HTML files
run: |
find src/ -name '*.html' -exec sh -c 'html-minifier-terser --collapse-whitespace --remove-comments --minify-js true --minify-css true -o "${0%.html}.min.html" "$0"' {} \;
find src/ -name '*.html' ! -name '*min*' -exec sh -c 'html-minifier-terser --collapse-whitespace --remove-comments --minify-js true --minify-css true -o "${0%.html}.min.html" "$0"' {} \;
- name: Minify CSS files
run: |
find src/css/ -name '*.css' -exec sh -c 'csso "$0" --output "${0%.css}.min.css"' {} \;
find src/css/ -name '*.css' ! -name '*min*' -exec sh -c 'csso "$0" --output "${0%.css}.min.css"' {} \;
- name: Commit and push changes
env:

27
default.conf Normal file
View File

@ -0,0 +1,27 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.min.html;
autoindex on;
}
# TODO: This could be improved later
location = /links {
root /usr/share/nginx/html;
index links.min.html;
try_files /links.min.html =404;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

10
docker-compose.yml Normal file
View File

@ -0,0 +1,10 @@
services:
pontus-web:
build: .
image: pontus-web:latest
restart: always
ports:
- "2280:80"
volumes:
- ./default.conf:/etc/nginx/conf.d/default.conf
- ./src:/usr/share/nginx/html

57
self
View File

@ -1,57 +0,0 @@
#!/bin/bash
SC_VERSION=1.0.0
SC_CODENAME="portal"
COLOR_RESET="\033[0m"
COLOR_GREEN="\033[1;32m"
COLOR_RED="\033[1;31m"
COLOR_YELLOW="\033[1;33m"
COLOR_BLUE="\033[1;34m"
COLOR_CYAN="\033[1;36m"
function start() {
if [ ! -d "src" ]; then
echo -e "${COLOR_RED}src directory not found, cannot continue${COLOR_RESET}"
exit 1
fi
mkdir -p public
cp -r src/* public/
echo -e "${COLOR_GREEN}Created public dir and copied files successfully${COLOR_RESET}"
}
function stop() {
if [ -d "public" ]; then
rm -rf public
echo -e "${COLOR_GREEN}Deleted public directory${COLOR_RESET}"
else
echo -e "${COLOR_RED}No public directory to delete${COLOR_RESET}"
fi
}
function help() {
echo -e "${COLOR_GREEN}self version:${COLOR_RESET} ${COLOR_BLUE}${SC_VERSION} ${SC_CODENAME}${COLOR_RESET}"
echo -e "${COLOR_BLUE}Usage:${COLOR_RESET} ./self [command]\n"
echo -e "${COLOR_YELLOW}Commands:${COLOR_RESET}"
echo -e " ${COLOR_CYAN}help${COLOR_RESET} Shows this help message."
echo -e " ${COLOR_CYAN}start${COLOR_RESET} Copies files to public directory."
echo -e " ${COLOR_CYAN}stop${COLOR_RESET} Removes public directory."
}
case "$1" in
start)
start
;;
stop)
stop
;;
help)
help
;;
*)
echo -e "${COLOR_RED}Invalid command: $1\n${COLOR_RESET}"
help
exit 1
;;
esac

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pontus</title>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/main.min.css">
</head>
<body>
<!-- YOU CARE ABOUT MY CODE?! -->
@ -13,7 +13,7 @@
<div class="sb-itm">
<h1 style="font-size: medium;">menu</h1>
<b>home</b>
<a href="/links.html">links</a>
<a href="/links">links</a>
</div>
<div class="sb-itm">
<h1 style="font-size: medium;">archives</h1>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pontus</title>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/main.min.css">
</head>
<body>
<!-- YOU CARE ABOUT MY CODE?! -->