Synced Flow can be used in WordPress themes and plugins without asking WordPress to resolve npm CSS imports in the browser.
pnpm add @syncedco/flow
pnpm exec synced-flow init --preset wordpress
pnpm flow:buildThe WordPress preset:
- scans
templates,parts,patterns,blocks,inc,includes,src, andassetswhen those folders exist - scans PHP, HTML, JS, TS, JSX, TSX, Twig, Vue, Svelte, Astro, and MDX files
- enables
includeCore - writes
assets/css/synced-flow.css - writes a
theme.jsonpalette that maps WordPress colour presets to Synced Flow semantic tokens
See examples/wordpress for a lean block theme style
template with theme.json, template parts, PHP patterns, enqueue code, and an
enqueue-ready generated CSS output.
examples/wordpress/
functions.php
theme.json
synced-flow.config.mjs
assets/css/synced-flow.css
parts/header.html
parts/footer.html
templates/front-page.html
templates/index.html
patterns/landing-hero.php
patterns/feature-grid.php
patterns/contact-cta.php
wp_enqueue_style(
'synced-flow',
get_theme_file_uri('assets/css/synced-flow.css'),
[],
wp_get_theme()->get('Version')
);For plugins, use plugins_url() or plugin_dir_url() instead of
get_theme_file_uri().
WordPress emits editor preset classes such as .has-base-background-color,
.has-primary-color, and .has-large-font-size with !important. Treat those
classes as the editor's chosen design value.
Do not override .has-* preset classes in project CSS. Add or choose a better
semantic preset instead, then use that preset on the block.
The generated theme.json maps common WordPress colour presets to Synced Flow
tokens:
{
"slug": "surface-elevated",
"name": "Surface Elevated",
"color": "var(--sf-colour-surface-elevated, var(--sf-colour-surface-raised))"
}Use those presets for any block that needs an editor-visible design role:
basefor page backgroundssurfaceandsurface-altfor standard panelssurface-elevatedfor chrome, mastheads, footers, sticky bars, and raised regionsprimaryandprimary-foregroundfor branded actions
If a new visual role appears repeatedly, add it to synced-flow.config.mjs and
expose it in theme.json; avoid adding !important overrides.
Synced Flow generates utility CSS from complete class tokens. Keep class names complete in PHP and templates.
<section class="sf-section text-primary">When a class is composed dynamically, add the full class to safelist.