← All work

Case study · Studio product

Pro-level styling for core blocks, without the bloat.

A WordPress plugin that gives Gutenberg's own blocks responsive and hover controls, compiled on the server into a few lines of scoped CSS.

Type
WordPress plugin
Built on
Block API, core blocks
Our role
Architecture, build
Status
In use on client builds
Block editor with a Group block selected, its padding shown as hatched areas, and the Rakaposh Dimensions panel with desktop, tablet and mobile padding and margin fields

The problem

We build most client sites on custom WordPress themes with the block editor. Core blocks are clean, but they can't set different spacing per device or style a hover state, so every project ended in hand-written CSS or a third-party block library.

Those libraries trade one problem for two: they load large bundles on every page, and many write styling into the saved HTML, which breaks with "this block contains unexpected content" errors when the plugin updates or goes away.

We wanted the controls without either cost: an internal tool that makes our own builds faster, not a rival to the big block suites.

How it works

Diagram: settings stored in the block comment are compiled by a PHP Style Engine on render_block into a hashed, scoped CSS class, output as one small inline stylesheet per page, with a JavaScript mirror for the live editor preview

Key decisions

Extend core, never replace it.

Controls attach to WordPress's own Group, Paragraph and other core blocks. No proprietary blocks to get locked into, and content keeps rendering if the plugin is ever switched off.

No styling saved as HTML.

Settings live in a versioned attribute in the block comment and are compiled at render time. Changing how a style is generated never breaks a saved page or triggers block validation errors.

One compiler, two places.

A pure PHP Style Engine renders the front end; a JavaScript mirror of the same rules drives the live editor preview, so what you see is what ships.

Built in phases.

The Style Engine and responsive spacing came first, on Group and Paragraph only. Typography, effects, a Section block and patterns follow once each layer is solid.

Responsive by default

Every spacing value can differ on desktop, tablet and mobile, and each device can inherit from the one above. Editors set it with three clicks instead of a stylesheet.

The same block shown on desktop, tablet and mobile with padding of 96/120, 64/48 and 32/20

Stack

  • PHP
  • WordPress Block API
  • render_block filter
  • React (block editor)
  • JavaScript
  • CSS

Building on WordPress? Let's make it fast.