Run [page minifier](https://www.npmjs.com/package/minify) locally before deployment

This commit is contained in:
KazushiM
2023-01-31 23:27:04 +08:00
parent a5e63bc034
commit 9cfe812247
6 changed files with 17 additions and 826 deletions

View File

@@ -1,5 +1,5 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages (Configurator)
name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
@@ -32,22 +32,11 @@ jobs:
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2
- name: HTML/CSS/JS Minifier
# You may pin to the exact commit or the version.
# uses: devatherock/minify-js@a25175eaf2c438680b21b73882d4837418e9d58b
uses: devatherock/minify-js@v1.0.3
with:
# File to minify or a folder containing files to minify. By default, all files in current folder and its subfolders will be minified
directory: './pages/dist' # optional
# Path where the minified files will be saved. By default, the minified files will be saved in the original file path
output: './pages/dist_min' # optional
# Indicates if the output files should have the suffix '.min' added after the name. Default is true
add_suffix: false # optional
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: './pages/dist_min'
path: './pages/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

View File

@@ -1,6 +1,15 @@
#!/bin/bash
[ -d "./tmp" ] || mkdir ./tmp
[ -d "./dist" ] || mkdir ./dist
cp -Rf ./src/*.html ./dist/
# README_HTML=`pandoc -f gfm -t html5 ../README.md`
tsc ./src/main.ts --outDir ./dist/ -lib es2015,dom -t es2015
cp -Rf ./src/*.html ./tmp/
tsc ./src/main.ts --outDir ./tmp/ -lib es2015,dom -t es2015
for FILE in ./tmp/*; do
minify "${FILE}" > "./dist/${FILE/.\/tmp\/}"
done
rm -fr ./tmp

404
pages/dist/index.html vendored

File diff suppressed because one or more lines are too long

406
pages/dist/main.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -380,7 +380,7 @@
<form id="form">
<label for="file">
<input id="file" type="file">
<p id="cust_rev">Upload loader.kip here</p>
<small id="cust_rev">Upload loader.kip here</small>
</label>
</form>
</body>

View File

@@ -72,7 +72,6 @@ class CustEntry {
}
createElement() {
let form = document.getElementById("form")!;
let input = this.getInputElement();
if (!input) {
let grid = document.createElement("div");
@@ -97,7 +96,7 @@ class CustEntry {
desc.setAttribute("for", this.id);
grid.appendChild(desc);
form.appendChild(grid);
document.getElementById("form")!.appendChild(grid);
let tooltip = new ErrorToolTip(this.id);
tooltip.addChangeListener();