Skip to content

Commit 2243e8c

Browse files
committed
fix: rename sassPath to installDir, add fallthrough comment, update copyright
1 parent a4c3c25 commit 2243e8c

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/core/dart-sass.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* dart-sass.ts
33
*
4-
* Copyright (C) 2020-2022 Posit Software, PBC
4+
* Copyright (C) 2020-2025 Posit Software, PBC
55
*/
66
import { join } from "../deno_ral/path.ts";
77

@@ -58,10 +58,10 @@ export async function dartCompile(
5858
*/
5959
export interface DartCommandOptions {
6060
/**
61-
* Override the path to the dart-sass install directory.
61+
* Override the dart-sass install directory.
6262
* Used for testing with non-standard paths (spaces, accented characters).
6363
*/
64-
sassPath?: string;
64+
installDir?: string;
6565
}
6666

6767
/**
@@ -86,8 +86,11 @@ function resolveSassCommand(options?: DartCommandOptions): {
8686
cmd: string;
8787
baseArgs: string[];
8888
} {
89-
const sassPath = options?.sassPath;
90-
if (sassPath == null) {
89+
const installDir = options?.installDir;
90+
if (installDir == null) {
91+
// Only check env var override when no explicit installDir is provided.
92+
// If QUARTO_DART_SASS doesn't exist on disk, fall through to use the
93+
// bundled dart-sass at the default architectureToolsPath.
9194
const dartOverrideCmd = Deno.env.get("QUARTO_DART_SASS");
9295
if (dartOverrideCmd) {
9396
if (!existsSync(dartOverrideCmd)) {
@@ -100,7 +103,7 @@ function resolveSassCommand(options?: DartCommandOptions): {
100103
}
101104
}
102105

103-
const sassDir = sassPath ?? architectureToolsPath("dart-sass");
106+
const sassDir = installDir ?? architectureToolsPath("dart-sass");
104107

105108
if (isWindows) {
106109
return {

tests/unit/dart-sass.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ unitTest(
6060
Deno.writeTextFileSync(inputScss, "body { color: red; }");
6161

6262
const result = await dartCommand([inputScss, outputCss], {
63-
sassPath: spacedSassDir,
63+
installDir: spacedSassDir,
6464
});
6565

6666
assert(
@@ -106,7 +106,7 @@ unitTest(
106106
Deno.writeTextFileSync(inputScss, "body { color: blue; }");
107107

108108
const result = await dartCommand([inputScss, outputCss], {
109-
sassPath: accentedSassDir,
109+
installDir: accentedSassDir,
110110
});
111111

112112
assert(

0 commit comments

Comments
 (0)