From 327b2318d09da55a6d2d6234b481fefe19dce805 Mon Sep 17 00:00:00 2001 From: Christopher Monsanto Date: Fri, 21 Aug 2026 00:54:32 -0400 Subject: [PATCH] Fold the spritesheet webp into the sheet rule The sheet's png fed a separate cwebp rule, the one place a rule output was another rule's input. A third output plus %o1 says the same thing in one rule; the published css and webp come out byte-identical. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01MQicnpaee6kQXGG7uVExLS --- assets.build.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/assets.build.ts b/assets.build.ts index 4139e3f3..4e930c9a 100644 --- a/assets.build.ts +++ b/assets.build.ts @@ -18,9 +18,10 @@ let SERVED = '/__assets'; let minispriteInputs = spriteglob(['src/minisprites/pokemon/gen6/*', 'src/minisprites/items/*'], {a: false}); // Smogdex spritesheet. The sheet tool bakes sprite ids parsed from the %f -// filenames into the css, hence nameSensitive. +// filenames into the css, hence nameSensitive. The png is declared only so +// cwebp has something to read; only the css and the webp are published. -let [sheetPng, sheetCss] = rule(minispriteInputs, { +let [, sheetCss, sheetWebp] = rule(minispriteInputs, { display: 'smogdex sheet', nameSensitive: true, deps: [ @@ -30,10 +31,11 @@ let [sheetPng, sheetCss] = rule(minispriteInputs, { 'lib/root/index.ts', 'tools/smogdexspritesheet/index.ts', ], - cmds: ['node tools/smogdexspritesheet/index.ts --image %o1 --stylesheet %o2 -- %f'], -}, ['spritesheet.png', 'spritesheet.css']); - -let sheetWebp = rule(sheetPng, ['cwebp -z 9 %f -o %o'], 'spritesheet.webp'); + cmds: [ + 'node tools/smogdexspritesheet/index.ts --image %o1 --stylesheet %o2 -- %f', + 'cwebp -z 9 %o1 -o %o3', + ], +}, ['spritesheet.png', 'spritesheet.css', 'spritesheet.webp']); // Hash-stamped css + webp. The css url rides in __meta/ for the dex to read. deploy(async ctx => {