Skip to content

Commit 4333a9e

Browse files
committed
fix: preserve option precedence over env var in resolveSassCommand
Explicit installDir option (used by tests) should take precedence over QUARTO_DART_SASS env var, matching the previous sassPath behavior.
1 parent 513be4c commit 4333a9e

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

src/core/dart-sass.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,30 @@ function resolveSassCommand(options?: DartCommandOptions): {
7575
cmd: string;
7676
baseArgs: string[];
7777
} {
78-
const dartOverrideCmd = Deno.env.get("QUARTO_DART_SASS");
79-
if (dartOverrideCmd) {
80-
if (!existsSync(dartOverrideCmd)) {
81-
warnOnce(
82-
`Specified QUARTO_DART_SASS does not exist, using built in dart sass.`,
83-
);
84-
} else {
85-
return { cmd: dartOverrideCmd, baseArgs: [] };
78+
const installDir = options?.installDir;
79+
if (!installDir) {
80+
const dartOverrideCmd = Deno.env.get("QUARTO_DART_SASS");
81+
if (dartOverrideCmd) {
82+
if (!existsSync(dartOverrideCmd)) {
83+
warnOnce(
84+
`Specified QUARTO_DART_SASS does not exist, using built in dart sass.`,
85+
);
86+
} else {
87+
return { cmd: dartOverrideCmd, baseArgs: [] };
88+
}
8689
}
8790
}
8891

89-
const installDir = options?.installDir ??
90-
architectureToolsPath("dart-sass");
92+
const sassDir = installDir ?? architectureToolsPath("dart-sass");
9193

9294
if (isWindows) {
9395
return {
94-
cmd: join(installDir, "src", "dart.exe"),
95-
baseArgs: [join(installDir, "src", "sass.snapshot")],
96+
cmd: join(sassDir, "src", "dart.exe"),
97+
baseArgs: [join(sassDir, "src", "sass.snapshot")],
9698
};
9799
}
98100

99-
return { cmd: join(installDir, "sass"), baseArgs: [] };
101+
return { cmd: join(sassDir, "sass"), baseArgs: [] };
100102
}
101103

102104
export async function dartCommand(

0 commit comments

Comments
 (0)