mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 22:22:43 -05:00
Dont break pipe when sass has an error
This commit is contained in:
parent
cbfcc50563
commit
04c43acf39
1 changed files with 26 additions and 19 deletions
|
@ -11,12 +11,14 @@ let sass = null;
|
||||||
|
|
||||||
async function compileSassAll() {
|
async function compileSassAll() {
|
||||||
const start = process.hrtime();
|
const start = process.hrtime();
|
||||||
log.info("init: compile styles")
|
log.info("init: compile styles");
|
||||||
|
try {
|
||||||
sass = await h.compileSassAll(worker);
|
sass = await h.compileSassAll(worker);
|
||||||
let output = await h.concatSass(sass);
|
let output = await h.concatSass(sass);
|
||||||
await fs.writeFile("./resources/public/css/main.css", output);
|
await fs.writeFile("./resources/public/css/main.css", output);
|
||||||
|
} catch (error) {
|
||||||
|
log.error("Error during compileSassAll: ", error);
|
||||||
|
}
|
||||||
const end = process.hrtime(start);
|
const end = process.hrtime(start);
|
||||||
log.info("done: compile styles", `(${ppt(end)})`);
|
log.info("done: compile styles", `(${ppt(end)})`);
|
||||||
}
|
}
|
||||||
|
@ -24,24 +26,27 @@ async function compileSassAll() {
|
||||||
async function compileSass(path) {
|
async function compileSass(path) {
|
||||||
const start = process.hrtime();
|
const start = process.hrtime();
|
||||||
log.info("changed:", path);
|
log.info("changed:", path);
|
||||||
|
try {
|
||||||
const result = await h.compileSass(worker, path, { modules: true });
|
const result = await h.compileSass(worker, path, { modules: true });
|
||||||
sass.index[result.outputPath] = result.css;
|
sass.index[result.outputPath] = result.css;
|
||||||
|
|
||||||
const output = h.concatSass(sass);
|
const output = h.concatSass(sass);
|
||||||
|
|
||||||
await fs.writeFile("./resources/public/css/main.css", output);
|
await fs.writeFile("./resources/public/css/main.css", output);
|
||||||
|
} catch (error) {
|
||||||
|
log.error("Error during compileSass: ", error);
|
||||||
|
}
|
||||||
const end = process.hrtime(start);
|
const end = process.hrtime(start);
|
||||||
log.info("done:", `(${ppt(end)})`);
|
log.info("done:", `(${ppt(end)})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await compileSassAll();
|
await compileSassAll();
|
||||||
await h.copyAssets()
|
await h.copyAssets();
|
||||||
await h.compileSvgSprites()
|
await h.compileSvgSprites();
|
||||||
await h.compileTemplates();
|
await h.compileTemplates();
|
||||||
await h.compilePolyfills();
|
await h.compilePolyfills();
|
||||||
|
|
||||||
log.info("watch: scss src (~)")
|
log.info("watch: scss src (~)");
|
||||||
|
|
||||||
h.watch("src", h.isSassFile, async function (path) {
|
h.watch("src", h.isSassFile, async function (path) {
|
||||||
if (path.includes("common")) {
|
if (path.includes("common")) {
|
||||||
|
@ -51,19 +56,19 @@ h.watch("src", h.isSassFile, async function (path) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info("watch: scss: resources (~)")
|
log.info("watch: scss: resources (~)");
|
||||||
h.watch("resources/styles", h.isSassFile, async function (path) {
|
h.watch("resources/styles", h.isSassFile, async function (path) {
|
||||||
log.info("changed:", path);
|
log.info("changed:", path);
|
||||||
await compileSassAll()
|
await compileSassAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info("watch: templates (~)")
|
log.info("watch: templates (~)");
|
||||||
h.watch("resources/templates", null, async function (path) {
|
h.watch("resources/templates", null, async function (path) {
|
||||||
log.info("changed:", path);
|
log.info("changed:", path);
|
||||||
await h.compileTemplates();
|
await h.compileTemplates();
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info("watch: assets (~)")
|
log.info("watch: assets (~)");
|
||||||
h.watch(["resources/images", "resources/fonts", "resources/plugins-runtime"], null, async function (path) {
|
h.watch(["resources/images", "resources/fonts", "resources/plugins-runtime"], null, async function (path) {
|
||||||
log.info("changed:", path);
|
log.info("changed:", path);
|
||||||
await h.compileSvgSprites();
|
await h.compileSvgSprites();
|
||||||
|
@ -71,4 +76,6 @@ h.watch(["resources/images", "resources/fonts", "resources/plugins-runtime"], nu
|
||||||
await h.compileTemplates();
|
await h.compileTemplates();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
process.on("exit", () => {
|
||||||
worker.terminate();
|
worker.terminate();
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue