Fixed crash on SCSS error.
This commit is contained in:
parent
2eaa38c955
commit
fc2406eea4
37
dev.js
37
dev.js
|
@ -20,26 +20,31 @@ njk.configure(
|
||||||
chokidar.watch("./src").on("change", () => {
|
chokidar.watch("./src").on("change", () => {
|
||||||
console.log("Detected changes in SCSS! Recompiling...")
|
console.log("Detected changes in SCSS! Recompiling...")
|
||||||
|
|
||||||
const { css } = sass.compile(
|
try {
|
||||||
"./src/main.scss",
|
const { css } = sass.compile(
|
||||||
{
|
"./src/main.scss",
|
||||||
sourceMap: false,
|
{
|
||||||
alertColor: true,
|
sourceMap: false,
|
||||||
style: "compressed"
|
alertColor: true,
|
||||||
}
|
style: "compressed"
|
||||||
)
|
}
|
||||||
|
)
|
||||||
|
|
||||||
console.log("Compile done! Saving changes...")
|
console.log("Compile done! Saving changes...")
|
||||||
|
|
||||||
if (!fs.existsSync("./out"))
|
if (!fs.existsSync("./out"))
|
||||||
fs.mkdirSync("./out")
|
fs.mkdirSync("./out")
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
"./out/main.css",
|
"./out/main.css",
|
||||||
css
|
css
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log("Saved!")
|
console.log("Saved!")
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error while compiling!")
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
server.use("/assets", express.static("./out"))
|
server.use("/assets", express.static("./out"))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user