Skip to content

Commit 44cf2b3

Browse files
dragonstylejjallaire
authored andcommitted
Allow dart sass override
1 parent fc05c78 commit 44cf2b3

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/core/dart-sass.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { execProcess } from "./process.ts";
1111
import { TempContext } from "./temp.ts";
1212
import { lines } from "./text.ts";
1313
import { info } from "log/mod.ts";
14+
import { existsSync } from "fs/mod.ts";
15+
import { warnOnce } from "./log.ts";
1416

1517
export function dartSassInstallDir() {
1618
return toolsPath("dart-sass");
@@ -51,8 +53,23 @@ export async function dartCompile(
5153
}
5254

5355
async function dartCommand(args: string[]) {
54-
const command = Deno.build.os === "windows" ? "sass.bat" : "sass";
55-
const sass = toolsPath(join("dart-sass", command));
56+
const resolvePath = () => {
57+
const dartOverrideCmd = Deno.env.get("QUARTO_DART_SASS");
58+
if (dartOverrideCmd) {
59+
if (!existsSync(dartOverrideCmd)) {
60+
warnOnce(
61+
`Specified QUARTO_DART_SASS does not exist, using built in dart sass.`,
62+
);
63+
} else {
64+
return dartOverrideCmd;
65+
}
66+
}
67+
68+
const command = Deno.build.os === "windows" ? "sass.bat" : "sass";
69+
return toolsPath(join("dart-sass", command));
70+
};
71+
const sass = resolvePath();
72+
5673
const cmd = [
5774
sass,
5875
...args,

0 commit comments

Comments
 (0)