@koda-sl/baker-cli 0.158.1 → 0.158.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cli.js +6 -3
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4809,6 +4809,7 @@ baker brand fonts fetch "Inter" --subsets latin,latin-ext # add accented-glyph
|
|
|
4809
4809
|
- **Failures carry the numbers, so nothing needs a second call.** `check`'s error keeps the full per-family breakdown at `error.fix.families` (healthy families included, so a multi-family brand shows what not to touch), and both commands probe the standard weights to report the ones that *do* exist at `error.fix.served` — the remediation is "retry with one of these" rather than "run `check`", which would be the command that just failed.
|
|
4810
4810
|
- **`fetch`** downloads the family into `src/brand/fonts/` and prints the `@font-face` block to paste above `@theme`. Defaults to the `latin` subset; `--subsets latin,latin-ext` adds accented-glyph coverage for Spanish and Portuguese copy. One file per weight *and* subset, since Google ships them separately and `unicode-range` is carried through verbatim.
|
|
4811
4811
|
- **It does not edit `global.css` for you.** Paste the block, then drop that family from the Google `@import` — otherwise the page self-hosts *and* still calls Google. Record the weights in `src/brand/BRAND.md` in the same change.
|
|
4812
|
+
- **The emitted `src:` is relative to `global.css` (`../brand/fonts/…`) on purpose — keep it that way.** A root-relative `/src/brand/fonts/…` reads to the bundler as a path something else already serves, so the file never lands in the published build and every page 404s it. That failure is silent: an unfetchable face falls back to a system font, so the site just renders off-brand. Kept relative, the bundler resolves it on disk, content-hashes it, and ships it. The scaffold's `validate-public-asset-refs` blocks the root-relative form.
|
|
4812
4813
|
- **Licensing:** Google Fonts are open-licensed and safe to self-host. A client's own commercial typeface is not — confirm before re-hosting one.
|
|
4813
4814
|
|
|
4814
4815
|
Complements the offline `validate-brand-fonts` check that runs in the scaffold's `verify`: that one compares what `global.css` declares against what provides it, with no network. Only the network can answer whether Google really serves a given family and weight.
|
package/dist/cli.js
CHANGED
|
@@ -16618,7 +16618,10 @@ function fontFileName(face) {
|
|
|
16618
16618
|
const style = face.style === "italic" ? "italic" : "";
|
|
16619
16619
|
return `${family}-${face.weight}${style}-${face.subset}.woff2`;
|
|
16620
16620
|
}
|
|
16621
|
-
function
|
|
16621
|
+
function fontFaceHref(face) {
|
|
16622
|
+
return `../brand/fonts/${fontFileName(face)}`;
|
|
16623
|
+
}
|
|
16624
|
+
function renderFontFaceCss(faces) {
|
|
16622
16625
|
return faces.map(
|
|
16623
16626
|
(face) => [
|
|
16624
16627
|
"@font-face {",
|
|
@@ -16626,7 +16629,7 @@ function renderFontFaceCss(faces, hrefFor) {
|
|
|
16626
16629
|
` font-style: ${face.style};`,
|
|
16627
16630
|
` font-weight: ${face.weight};`,
|
|
16628
16631
|
" font-display: swap;",
|
|
16629
|
-
` src: url('${
|
|
16632
|
+
` src: url('${fontFaceHref(face)}') format('woff2');`,
|
|
16630
16633
|
...face.unicodeRange ? [` unicode-range: ${face.unicodeRange};`] : [],
|
|
16631
16634
|
"}"
|
|
16632
16635
|
].join("\n")
|
|
@@ -16866,7 +16869,7 @@ var fontsFetchCommand = defineCommand86({
|
|
|
16866
16869
|
explanation: "The font stylesheet resolved but the font files themselves did not download."
|
|
16867
16870
|
});
|
|
16868
16871
|
}
|
|
16869
|
-
const fontFace = renderFontFaceCss(downloaded
|
|
16872
|
+
const fontFace = renderFontFaceCss(downloaded);
|
|
16870
16873
|
const downloadedWeights = [...new Set(downloaded.map((f) => f.weight))].sort((a, b) => a - b);
|
|
16871
16874
|
const incomplete = weights.filter((w) => !downloadedWeights.includes(w));
|
|
16872
16875
|
writeJson({
|