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", () => {
|
||||
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"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user