Skip to content

Commit ce9aac0

Browse files
committed
trim resulting css, only add dep if file is nonempty
1 parent 78059cb commit ce9aac0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/command/render/pandoc-html.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import { kSassBundles } from "../../config/types.ts";
4141
import { md5HashBytes } from "../../core/hash.ts";
4242
import { InternalError } from "../../core/lib/error.ts";
4343
import { writeTextFileSyncPreserveMode } from "../../core/write.ts";
44-
import { getStack } from "../../core/deno/debug.ts";
4544
import { assert } from "testing/asserts";
4645

4746
// The output target for a sass bundle
@@ -163,6 +162,9 @@ export async function resolveSassBundles(
163162
// it can happen that processing generate an empty css file (e.g quarto-html deps with Quarto CSS variables)
164163
// in that case, no need to insert the cssPath in the dependency
165164
if (!cssPath) continue;
165+
if (Deno.readTextFileSync(cssPath).length === 0) {
166+
continue;
167+
}
166168

167169
// Process attributes (forward on to the target)
168170
for (const bundle of target.bundles) {

src/core/sass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,5 +422,5 @@ export function cleanSourceMappingUrl(cssPath: string): void {
422422
kSourceMappingRegexes[1],
423423
"",
424424
);
425-
writeTextFileSyncPreserveMode(cssPath, cleaned);
425+
writeTextFileSyncPreserveMode(cssPath, cleaned.trim());
426426
}

0 commit comments

Comments
 (0)