stylesheetAsset

tcmts.cli.web.stylesheetAsset · #udapw7kc · term · runs anywhere

The file a stylesheet of the codebase (a .css file) is served as, under /_app/assets/: its name and its hash, so it's kept for good, and the same in every build that has it. Named as a chunk is (chunkStem), so a browser holding the last version of it is sent the next as what changed.

import type { DefRecord } from "#codebase/tcmts/core/types";

export function stylesheetAsset(rec: DefRecord): string {
  return `${rec.nameHint.replace(/[^\w-]/g, "_")}-${rec.hash.slice(0, 8)}.css`;
}

uses

used by