Fixed crash on SCSS error.

This commit is contained in:
BurnyLlama 2023-03-06 10:20:47 +01:00
parent 2eaa38c955
commit fc2406eea4

37
dev.js
View File

@ -20,26 +20,31 @@ njk.configure(
chokidar.watch("./src").on("change", () => {
console.log("Detected changes in SCSS! Recompiling...")
const { css } = sass.compile(
"./src/main.scss",
{
sourceMap: false,
alertColor: true,
style: "compressed"
}
)
try {
const { css } = sass.compile(
"./src/main.scss",
{
sourceMap: false,
alertColor: true,
style: "compressed"
}
)
console.log("Compile done! Saving changes...")
console.log("Compile done! Saving changes...")
if (!fs.existsSync("./out"))
fs.mkdirSync("./out")
if (!fs.existsSync("./out"))
fs.mkdirSync("./out")
fs.writeFileSync(
"./out/main.css",
css
)
fs.writeFileSync(
"./out/main.css",
css
)
console.log("Saved!")
console.log("Saved!")
} catch (error) {
console.log("Error while compiling!")
console.error(error)
}
})
server.use("/assets", express.static("./out"))