Shared Nuxt theme components, templates, icons, and Sass foundations for King & Partners projects.
Install the package:
yarn add @kingandpartners/nuxt-themeCompose its shared theme path into the platform configuration:
import platformConfig from '@kingandpartners/nuxt-platform/config';
import themeConfig from '@kingandpartners/nuxt-theme/config';
export default defineNuxtConfig(platformConfig(themeConfig()));The platform uses the supplied path to register shared components and templates,
load shared base Sass, and resolve the !!shared Sass alias. The consumer
continues to own src/themes/<site>, so project-specific components and styles
can override or extend the shared theme.
breakpoint() resolves a name from the shared scale in
src/theme/assets/scss/abstracts/_breakpoints.scss:
.hero {
@include breakpoint(tablet) { padding: 4rem; }
}An unknown name emits no media query — the declarations inside are dropped — and warns at compile time. Nothing errors, so watch for the warning; the symptom is missing CSS rather than a failed build.
Configure $custom-breakpoints where your theme forwards the shared abstracts,
usually src/themes/<site>/assets/scss/abstracts/index.scss:
@forward '!!shared/assets/scss/abstracts' with (
$custom-breakpoints: (
midMobile: (
min-width: 500px,
),
)
);
@forward 'colors';
@forward 'fonts';Custom entries are merged over the shared scale, so a same-named entry retunes an
existing breakpoint for that project instead of adding one. breakpoint() picks
these up with no further wiring.
Two constraints worth knowing:
- Configure it on the barrel your components already load. Each component stylesheet is its own Sass compilation, so configuration applied anywhere else will not be visible to them.
- The merged scale is
$all-breakpoints.$breakpointsremains the shared scale only, so read$all-breakpointsif you need the map directly.
A shared component usually needs a matching ACF field group, so this repo ships both halves and publishes them to two registries from a single git tag:
| Registry | Installed to | Contains |
|---|---|---|
| npm (GitHub Packages) | node_modules/@kingandpartners/nuxt-theme |
src/ — the Vue SFCs and Sass |
| Composer (VCS) | web/app/mu-plugins/nuxt-theme |
cms/ — the ACF field groups |
One tag, one version number, so a component and its schema cannot drift.
The split exists because node_modules never reaches the WordPress container —
a project's Dockerfile.deploy copies only wordpress/, cms/, src/ and
bin/. Field definitions therefore have to travel over Composer.
.gitattributes keeps each distribution lean: src/ is export-ignored so it
stays out of the mu-plugin, and npm packs from the files list in
package.json so cms/ stays out of the node package.
Consumers do not require this package directly. kp-starter depends on it, and
its loader globs the cms/shared tree of every sibling mu-plugin package,
registering what it finds with shared priority — so a project can still
override anything shipped here from its own cms/ or src/themes/<site>/ tree.
src/theme/components/<Name>/<Name>.vue(plus.scss) — auto-registered through the platform's component paths.cms/shared/components/<Name>/fields.json— a normal field group config, whosegroup.namebecomes thegroup_<name>key other configs can clone.
Nothing else is required; there is no registration list to update.