mirror of
https://github.com/penpot/penpot.git
synced 2025-02-12 10:09:03 -05:00
🐛 Fix debug css being included in prod builds
This commit is contained in:
parent
44a2a63fb8
commit
fb6ebcd074
1 changed files with 14 additions and 5 deletions
|
@ -27,6 +27,8 @@ export function startWorker() {
|
|||
});
|
||||
}
|
||||
|
||||
export const isDebug = process.env.NODE_ENV !== "production";
|
||||
|
||||
async function findFiles(basePath, predicate, options = {}) {
|
||||
predicate =
|
||||
predicate ??
|
||||
|
@ -75,6 +77,11 @@ export async function compileSass(worker, path, options) {
|
|||
return worker.exec("compileSass", [path, options]);
|
||||
}
|
||||
|
||||
export async function compileSassDebug(worker) {
|
||||
const result = await compileSass(worker, "resources/styles/debug.scss", {});
|
||||
return `${result.css}\n`;
|
||||
}
|
||||
|
||||
export async function compileSassAll(worker) {
|
||||
const limitFn = pLimit(4);
|
||||
const sourceDir = "src";
|
||||
|
@ -94,10 +101,7 @@ export async function compileSassAll(worker) {
|
|||
.filter(isDesignSystemFile)
|
||||
.map((path) => ph.join(sourceDir, path));
|
||||
|
||||
const procs = [
|
||||
compileSass(worker, "resources/styles/main-default.scss", {}),
|
||||
compileSass(worker, "resources/styles/debug.scss", {}),
|
||||
];
|
||||
const procs = [compileSass(worker, "resources/styles/main-default.scss", {})];
|
||||
|
||||
for (let path of [...dsFiles, ...appFiles]) {
|
||||
const proc = limitFn(() => compileSass(worker, path, { modules: true }));
|
||||
|
@ -176,7 +180,7 @@ async function renderTemplate(path, context = {}, partials = {}) {
|
|||
|
||||
context = Object.assign({}, context, {
|
||||
ts: ts,
|
||||
isDebug: process.env.NODE_ENV !== "production",
|
||||
isDebug,
|
||||
});
|
||||
|
||||
return mustache.render(content, context, partials);
|
||||
|
@ -401,6 +405,11 @@ export async function compileStyles() {
|
|||
await fs.mkdir("./resources/public/css", { recursive: true });
|
||||
await fs.writeFile("./resources/public/css/main.css", result);
|
||||
|
||||
if (isDebug) {
|
||||
let debugCSS = await compileSassDebug(worker);
|
||||
await fs.writeFile("./resources/public/css/debug.css", debugCSS);
|
||||
}
|
||||
|
||||
const end = process.hrtime(start);
|
||||
log.info("done: compile styles", `(${ppt(end)})`);
|
||||
worker.terminate();
|
||||
|
|
Loading…
Add table
Reference in a new issue