add minification for HTML and CSS, update links to minified files, and remove obsolete script
This commit is contained in:
parent
442620c4e4
commit
db01f1957c
46
.gitea/workflows/minify.yaml
Normal file
46
.gitea/workflows/minify.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
name: Minify HTML and CSS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
minify:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Install minification tools
|
||||
run: |
|
||||
npm install -g html-minifier-terser csso-cli
|
||||
|
||||
- name: Minify HTML files
|
||||
run: |
|
||||
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' ! -name '*min*' -exec sh -c 'csso "$0" --output "${0%.css}.min.css"' {} \;
|
||||
|
||||
- name: Commit and push changes
|
||||
env:
|
||||
USERNAME_GITEA: ${{ secrets.USERNAME_GITEA }}
|
||||
TOKEN_GITEA: ${{ secrets.TOKEN_GITEA }}
|
||||
run: |
|
||||
git config --global user.name "LibreCloud Actions Bot"
|
||||
git config --global user.email "git@pontusmail.org"
|
||||
git remote set-url origin https://${USERNAME_GITEA}:${TOKEN_GITEA}@git.pontusmail.org/aidan/pontus.git
|
||||
git add .
|
||||
git commit -m "[bot] Minifying HTML and CSS automatically"
|
||||
git push origin main
|
27
default.conf
Normal file
27
default.conf
Normal 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
10
docker-compose.yml
Normal 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
57
self
@ -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
|
1
src/css/main.min.css
vendored
Normal file
1
src/css/main.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
@font-face{font-family:"RainyHearts";src:url(/fonts/rainyhearts.ttf)format("truetype");font-weight:400;font-style:normal}@font-face{font-family:"Daydream";src:url(/fonts/Daydream.ttf)format("truetype");font-weight:400;font-style:normal}body{font-family:"RainyHearts"}h1{font-size:x-large}.title,h1{font-family:"Daydream"}.container{display:flex;height:97.5vh;overflow:hidden}.sidebar{width:17%;box-sizing:border-box;overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}.sidebar::-webkit-scrollbar{display:none}.sidebar a{display:block;margin:7px 0}.main-content{width:80%;overflow-y:auto;padding:0 20px 20px;box-sizing:border-box}.bt-section,.sb-itm{padding:10px 20px 20px;background-color:#f0f0f0;margin-bottom:5%}.bt-section{display:flex;flex-wrap:wrap;gap:10px}.bt-section a,.bt-section img{display:inline-block;margin:0}.contained-blinkie{width:100%}.contained-button img{width:44%}.fac img{padding-top:20px}*{cursor:url(https://cur.cursors-4u.net/cursors/cur-11/cur1055.ani),url(https://cur.cursors-4u.net/cursors/cur-11/cur1055.png),auto!important}
|
@ -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>
|
||||
|
@ -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?! -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user