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 # Violet's Purgatory
static/index.html static/index.html
static/cached static/cached
static/style.css

View file

@ -31,7 +31,6 @@ function getThumbor() {
thumbCount += 1 thumbCount += 1
return thumborInstances[thumbCount % thumborInstances.length] + "unsafe" return thumborInstances[thumbCount % thumborInstances.length] + "unsafe"
} }
app.use(express.static(staticpath))
app.listen(PORT, () => { app.listen(PORT, () => {
console.log("Violet's Purgatory is now listening on port: " + 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) => { app.get('/', async (req, res) => {
var html = await (pageUpdate()) var html = await (pageUpdate())
res.send(minify.minify(html)) res.send(minify.minify(html).toString('utf-8'))
}) })
app.get('/style.css', async (req, res) => { app.use(express.static(staticpath))
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((req, res, next) => { app.use((req, res, next) => {
res.status(404).send(` 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() { async function updateCommits() {
var codebergResponse = await (await fetch(`https://codeberg.org/Bingus_Violet/Violets-Purgatory/src/branch/${process.env.BRANCH || "origin"}`)).text() 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")) var commits = codebergResponse.substring(0, codebergResponse.indexOf("Commits"))

View file

@ -5,7 +5,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <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> <title>Violet's Purgatory</title>