Why Not Just Edit the Component?
Every file underlib/layouts/components/arrives from this library and is overwritten on reinstall. Nothing stops you from editing one, and sometimes that is the right call. But the moment you do,npm run components:statusreports the component asmodified, and adopting any future canon update becomes a merge instead of a copy.
A site that wants a component to look different has two bad options: edit the canon file, which makes the next update a merge, or out-specify it from site CSS, which turns styling into a specificity contest. Cascade layers remove the contest.
The Layer Order
With layers enabled inmetalsmith-bundled-components(version 1.4.0 or later; the Metalsmith2025 starter ships with it on), the bundled CSS declares its layer order up front, and every piece of CSS lands in a named layer:
@layer tokens, base, components, site;
@layer components.hero {
.hero { ... } /* canon component CSS, untouched on disk */
}
@layer site.hero {
.hero { --hero-gap: var(--space-l); } /* your override */
}In the cascade, a later layer beats an earlier one regardless of specificity. Anything insitebeats anything incomponents, whatever its selector and wherever it sits in the file. A one-class override wins over a canon rule with three, so overrides stay small, and there is no!importantand no.page .section .hero .textarms race.
One rule comes with this model, and it is not optional: unlayered CSS beats every cascade layer. Your site's own stylesheets must be assigned to layers too, belowcomponents, or one bare@importwill outrank the entire component catalog. In the starter, every import inlib/assets/main.cssnames its layer for exactly this reason.