Minify style

This commit is contained in:
Bingus_Violet 2024-02-07 11:58:26 -06:00
parent 281c704db2
commit c5cd07a60a
3 changed files with 14 additions and 11 deletions

1
.gitignore vendored
View file

@ -133,3 +133,4 @@ dist
# Violet's Purgatory
static/index.html
static/cached
static/style.css

View file

@ -31,7 +31,6 @@ function getThumbor() {
thumbCount += 1
return thumborInstances[thumbCount % thumborInstances.length] + "unsafe"
}
app.use(express.static(staticpath))
app.listen(PORT, () => {
console.log("Violet's Purgatory is now listening on port: " + PORT)
@ -444,16 +443,10 @@ lanyard.addEventListener("message", async (res) => {
app.get('/', async (req, res) => {
var html = await (pageUpdate())
res.send(minify.minify(html))
res.send(minify.minify(html).toString('utf-8'))
})
app.get('/style.css', async (req, res) => {
var cssPath = path.join(resourcePath, 'style.css')
var css = fs.readFileSync(cssPath).toString()
css = minify.minify(css)
res.send(css)
console.log(css)
})
app.use(express.static(staticpath))
app.use((req, res, next) => {
res.status(404).send(`
@ -463,6 +456,15 @@ app.use((req, res, next) => {
`)
})
function updateCSS() {
var css = fs.readFileSync(path.join(resourcePath, 'style.css')).toString()
css = minify.minify(css)
fs.writeFileSync(path.join(staticpath, 'style.css'), css) // Will add more in the future
}
updateCSS()
async function updateCommits() {
var codebergResponse = await (await fetch(`https://codeberg.org/Bingus_Violet/Violets-Purgatory/src/branch/${process.env.BRANCH || "origin"}`)).text()
var commits = codebergResponse.substring(0, codebergResponse.indexOf("Commits"))

View file

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/style.css">
<link rel="stylesheet" type="text/css" href="./style.css">
<title>Violet's Purgatory</title>