@se-studio/project-build 1.0.131 → 1.0.133
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/CHANGELOG.md +12 -0
- package/README.md +13 -14
- package/package.json +2 -4
- package/dist/management/sync-skills.d.ts +0 -4
- package/dist/management/sync-skills.d.ts.map +0 -1
- package/dist/management/sync-skills.js +0 -97
- package/dist/management/sync-skills.js.map +0 -1
- package/dist/seskills.d.ts +0 -9
- package/dist/seskills.d.ts.map +0 -1
- package/dist/seskills.js +0 -32
- package/dist/seskills.js.map +0 -1
- package/skills/contentful-cms/alt-text-audit/SKILL.md +0 -60
- package/skills/contentful-cms/cms-guidelines/README.md +0 -166
- package/skills/contentful-cms/cms-guidelines/colour-hint-prompt.md +0 -77
- package/skills/contentful-cms/cms-guidelines/evaluation-prompt.md +0 -84
- package/skills/contentful-cms/cms-guidelines/generate-component-guidelines.md +0 -126
- package/skills/contentful-cms/cms-guidelines/generation-prompt.md +0 -231
- package/skills/contentful-cms/cms-guidelines/html-component-authoring.md +0 -401
- package/skills/contentful-cms/cms-guidelines/validation-prompt.md +0 -170
- package/skills/contentful-cms/cms-guidelines/variant-loop.md +0 -189
- package/skills/contentful-cms/cms-guidelines/variant-proposal-prompt.md +0 -131
- package/skills/contentful-cms/core/SKILL.md +0 -793
- package/skills/contentful-cms/generate-all-guidelines/SKILL.md +0 -313
- package/skills/contentful-cms/generate-cms-guidelines/SKILL.md +0 -313
- package/skills/contentful-cms/image-guide/SKILL.md +0 -240
- package/skills/contentful-cms/manifest.json +0 -11
- package/skills/contentful-cms/navigation/SKILL.md +0 -23
- package/skills/contentful-cms/rich-text/SKILL.md +0 -96
- package/skills/contentful-cms/schema-org/SKILL.md +0 -74
- package/skills/contentful-cms/screenshots/SKILL.md +0 -46
- package/skills/contentful-cms/seo-descriptions/SKILL.md +0 -54
- package/skills/contentful-cms/templates/SKILL.md +0 -21
- package/skills/contentful-cms/update-cms-guidelines/SKILL.md +0 -348
- package/skills/se-marketing-sites/cms-routes-and-appshared/SKILL.md +0 -99
- package/skills/se-marketing-sites/create-collection/SKILL.md +0 -295
- package/skills/se-marketing-sites/create-component/SKILL.md +0 -250
- package/skills/se-marketing-sites/create-page/SKILL.md +0 -129
- package/skills/se-marketing-sites/curate-showcase-mocks/SKILL.md +0 -343
- package/skills/se-marketing-sites/handling-media/SKILL.md +0 -195
- package/skills/se-marketing-sites/lib-cms-structure/SKILL.md +0 -83
- package/skills/se-marketing-sites/register-cms-features/SKILL.md +0 -95
- package/skills/se-marketing-sites/styling-system/SKILL.md +0 -122
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: html-component-authoring
|
|
3
|
-
description: Guidelines for authoring HTML content in HtmlComponent CMS entries. Covers how to use the project style guide, what classes to use, field semantics, and common layout patterns.
|
|
4
|
-
license: Private
|
|
5
|
-
metadata:
|
|
6
|
-
author: se-core-product
|
|
7
|
-
version: "1.1.0"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# HtmlComponent Authoring Guide
|
|
11
|
-
|
|
12
|
-
`HtmlComponent` is a CMS content type that renders developer-authored HTML directly into the page. It bypasses the standard component registration system and is intended for one-off or highly custom layouts that the structured component library cannot produce.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Before You Start
|
|
17
|
-
|
|
18
|
-
**Read the project style guide.** Every app has an auto-generated HTML Component Style Guide at:
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
docs/cms-guidelines/html-component-style-guide.md
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
This file contains the exact colour names, typography class names, grid configuration, confirmed-safe Tailwind utilities, and custom utilities available for that specific project. It is derived from `tailwind.config.json`, `globals.css`, and the compiled source files — always consult it before writing any HTML.
|
|
25
|
-
|
|
26
|
-
If the file does not exist, generate it first:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
# From the app directory:
|
|
30
|
-
pnpm cms-generate-html-style-guide
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Ensure the rawHtml safelist is active.** The style guide generator also writes `src/generated/cms-rawhtml-safelist.css` containing `@source inline(...)` directives that force common spacing utilities into the compiled CSS bundle. This file must be imported once in `src/app/globals.css`:
|
|
34
|
-
|
|
35
|
-
```css
|
|
36
|
-
/* Add this line near the top of globals.css */
|
|
37
|
-
@import "../generated/cms-rawhtml-safelist.css";
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Without this import the safelist has no effect and the spacing classes in the Confirmed Safe list may not be compiled.
|
|
41
|
-
|
|
42
|
-
**Keep your working files in the project directory.** Write your `component.html`, `component.css`, and `component.js` files to a persistent location such as `/home/nick/test/cmsedit/<page-name>/` — not to `/tmp`. Files in `/tmp` are lost between sessions and cannot be reviewed or version-controlled.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## HtmlComponent Fields
|
|
47
|
-
|
|
48
|
-
| Field | Required | Type | Purpose |
|
|
49
|
-
|-------|----------|------|---------|
|
|
50
|
-
| `cmsLabel` | ✓ | Text | Internal label. **Set this immediately after creating the entry** — use a descriptive value like `"meridian-pricing-grid"` or `"demo-hero"`. The Contentful UI shows only this name; defaults like "New Hero" are useless at scale. |
|
|
51
|
-
| `rawHtml` | ✓ | Text | The HTML markup. Use Tailwind classes; never inline `style=` for colours/typography/layout. |
|
|
52
|
-
| `customCss` | — | Text | Scoped CSS. Rules are automatically prefixed with `[data-hc-id="<id>"]` — they cannot pollute other components. Use for responsive layout (`@media` queries), `:hover`, `::before`/`::after`, and any utility class not in the confirmed-safe list. |
|
|
53
|
-
| `customJs` | — | Text | JavaScript loaded via Next.js `<Script>`. A `hcRoot` variable pointing to this component's root element is automatically injected — use it to scope all queries. Use sparingly. |
|
|
54
|
-
| `markdownContent` | — | Text | Plain text for search indexing. **Always fill this** so the component appears in site search. |
|
|
55
|
-
| `isHero` | — | Boolean | `true` if the HTML contains an `<h1>`. Moves this block to the top of the page content flow. |
|
|
56
|
-
| `fullWidth` | — | Boolean | `true` for edge-to-edge (full-bleed) layouts that break out of the column grid. |
|
|
57
|
-
| `excludeFromSearch` | — | Boolean | `true` to exclude from search even if `markdownContent` is set. |
|
|
58
|
-
| `loadScriptOnce` | — | Boolean | `true` (default) to deduplicate the script tag when the same entry appears multiple times. |
|
|
59
|
-
| `scriptStrategy` | — | Enum | `afterInteractive` (default), `lazyOnload`, `beforeInteractive`. |
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## The Four Non-Negotiable Rules
|
|
64
|
-
|
|
65
|
-
1. **Use Tailwind classes, not inline styles.**
|
|
66
|
-
- ❌ `style="color: #FF5C00; font-size: 48px;"`
|
|
67
|
-
- ✓ `class="text-orange h2"`
|
|
68
|
-
|
|
69
|
-
2. **Use named colour classes from the palette.**
|
|
70
|
-
- ❌ `class="bg-[#1F2E32]"` or `style="background: #1F2E32"`
|
|
71
|
-
- ✓ `class="bg-dark text-light"`
|
|
72
|
-
|
|
73
|
-
3. **Use typography classes, not raw font sizes.**
|
|
74
|
-
- ❌ `class="text-[48px] font-semibold"`
|
|
75
|
-
- ✓ `class="h2"`
|
|
76
|
-
|
|
77
|
-
4. **Use the two-layer grid structure.** Every section needs an outer `container-cols-grid` wrapper (for page margins) and an inner `content-cols-grid` wrapper (for the 12-column content grid). See [Grid & Layout](#grid--layout).
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Colour Usage
|
|
82
|
-
|
|
83
|
-
All colour names are defined in the style guide. Use lowercase in Tailwind:
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
Dark → bg-dark / text-dark / border-dark
|
|
87
|
-
Light → bg-light / text-light / border-light
|
|
88
|
-
Orange → bg-orange / text-orange
|
|
89
|
-
Blue → bg-blue / text-blue
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
For dark backgrounds, pair with the contrast colour (`bg-dark text-light`). Check the "Contrast pair" column in the style guide to know which pairings are approved.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Typography Usage
|
|
97
|
-
|
|
98
|
-
Pick from the named type styles in the style guide. Apply directly to the element:
|
|
99
|
-
|
|
100
|
-
```html
|
|
101
|
-
<h1 class="h1">Large display heading (uppercase, 96–200px)</h1>
|
|
102
|
-
<h2 class="h2">Section heading (45–48px)</h2>
|
|
103
|
-
<h3 class="h3">Sub-heading (21–44px, uppercase)</h3>
|
|
104
|
-
<p class="p1">Large body (20–24px)</p>
|
|
105
|
-
<p class="p2">Standard body (16px)</p>
|
|
106
|
-
<p class="p3">Small body (13px)</p>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**For rich text blocks** (content rendered from Markdown or the CMS), wrap in an RTF class:
|
|
110
|
-
|
|
111
|
-
```html
|
|
112
|
-
<div class="rtf-standard">
|
|
113
|
-
<h2>Auto-styled heading</h2>
|
|
114
|
-
<p>Auto-styled paragraph with list and link support.</p>
|
|
115
|
-
</div>
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Available RTF classes: `rtf-standard`, `rtf-article`, `rtf-article-right`, `rtf-legal`, `rtf-embedded-entry`.
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## Grid & Layout
|
|
123
|
-
|
|
124
|
-
Every `HtmlComponent` section uses a **two-layer grid structure**. Without the outer layer, content has no page margins and elements stretch edge-to-edge.
|
|
125
|
-
|
|
126
|
-
```html
|
|
127
|
-
<!-- Required boilerplate for every section -->
|
|
128
|
-
<div class="w-full container-cols-grid container-rows-grid container-row-6-12 bg-dark text-light">
|
|
129
|
-
<div class="col-start-2 col-span-1 row-start-2 row-span-4 content-cols-grid">
|
|
130
|
-
<!-- col-span-* / laptop:col-start-* content here -->
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
**How the layers work:**
|
|
136
|
-
|
|
137
|
-
| Layer | Classes | Role |
|
|
138
|
-
|-------|---------|------|
|
|
139
|
-
| Outer | `container-cols-grid` | 3-column grid: `[margin \| content \| margin]`. Background colour and edge-to-edge visuals go here. |
|
|
140
|
-
| Outer | `container-rows-grid container-row-6-12` | Adds vertical spacing rows. Replace `container-row-6-12` with the spacing value you need (see table below). |
|
|
141
|
-
| Inner | `col-start-2 col-span-1` | Places the inner div in the centre content column (skips the margin columns). |
|
|
142
|
-
| Inner | `row-start-2 row-span-4` | Places the inner div in the content rows (skips the spacing rows). |
|
|
143
|
-
| Inner | `content-cols-grid` | Creates the 12-column content grid. `col-span-*` / `laptop:col-start-*` work inside here. |
|
|
144
|
-
|
|
145
|
-
### Vertical spacing values
|
|
146
|
-
|
|
147
|
-
Use `container-row-6-*` classes for bottom spacing. The values below all appear in the project's compiled source files and are guaranteed to be in the CSS bundle (confirmed via Tailwind JIT source scan).
|
|
148
|
-
|
|
149
|
-
| Class | Bottom space | Use for |
|
|
150
|
-
|-------|-------------|---------|
|
|
151
|
-
| `container-row-6-6` | 24px | Tight spacing |
|
|
152
|
-
| `container-row-6-8` | 32px | |
|
|
153
|
-
| `container-row-6-10` | 40px | |
|
|
154
|
-
| `container-row-6-12` | 48px | **Standard default** |
|
|
155
|
-
| `container-row-6-20` | 80px | Generous spacing |
|
|
156
|
-
| `container-row-6-24` | 96px | Hero / large sections |
|
|
157
|
-
|
|
158
|
-
For top spacing, source-confirmed values are `container-row-1-10` (40px), `container-row-1-24` (96px), `container-row-1-40` (160px).
|
|
159
|
-
|
|
160
|
-
> All values in the tables above appear in the project's source files and are compiled by Tailwind JIT. If you need a value not listed, use `padding-top` / `padding-bottom` in `customCss` instead — do not guess at unlisted `container-row-*` values as they may not be compiled.
|
|
161
|
-
|
|
162
|
-
### Column spans (inside the inner div)
|
|
163
|
-
|
|
164
|
-
| Use | Classes |
|
|
165
|
-
|-----|---------|
|
|
166
|
-
| Full width | `col-span-full` |
|
|
167
|
-
| Centered (one column margin each side) | `laptop:col-start-2 laptop:col-span-10` |
|
|
168
|
-
| Left half (text) | `laptop:col-start-2 laptop:col-span-4` |
|
|
169
|
-
| Right half (visual) | `laptop:col-start-7 laptop:col-span-5` |
|
|
170
|
-
|
|
171
|
-
For **full-bleed** content (background extends edge to edge), set `fullWidth: true` on the entry instead of using the two-layer structure. The outer grid is removed and you control the full viewport width.
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Breakpoints
|
|
176
|
-
|
|
177
|
-
All breakpoints are mobile-first. Use prefixes to override at larger sizes:
|
|
178
|
-
|
|
179
|
-
| Prefix | Min-width |
|
|
180
|
-
|--------|-----------|
|
|
181
|
-
| *(none)* | 0px (mobile default) |
|
|
182
|
-
| `tablet:` | 768px |
|
|
183
|
-
| `laptop:` | 1024px |
|
|
184
|
-
| `desktop:` | 1440px |
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Tailwind JIT Constraint
|
|
189
|
-
|
|
190
|
-
> **Critical — read before writing any classes.**
|
|
191
|
-
|
|
192
|
-
Tailwind only includes CSS for classes it finds in compiled source files (`.tsx`, `.ts`, `.css`). Classes written inside `rawHtml` CMS strings are **never scanned** — if a class isn't already used somewhere in the codebase, it silently has no effect.
|
|
193
|
-
|
|
194
|
-
**Rule: only use `tablet:` / `laptop:` prefixes that appear in the project style guide's Confirmed Safe Tailwind Utilities section** — they are proven to be in the compiled bundle. For any responsive behaviour not listed there, use `customCss` with `@media` queries instead.
|
|
195
|
-
|
|
196
|
-
For non-responsive utility classes, check the **Confirmed Safe Tailwind Utilities** section in the project style guide (`docs/cms-guidelines/html-component-style-guide.md`). These are extracted from the compiled source and are guaranteed to work. If a class isn't listed, use `customCss`.
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## Scoped CSS (`customCss`)
|
|
201
|
-
|
|
202
|
-
Use `customCss` for:
|
|
203
|
-
- **Responsive layout** — `@media` queries for flex direction, grid column counts, show/hide (see Tailwind JIT constraint above)
|
|
204
|
-
- Complex `:hover`, `::before`/`::after` interactions impossible with Tailwind
|
|
205
|
-
- Any utility class not in the project's confirmed-safe list
|
|
206
|
-
|
|
207
|
-
Rules are automatically scoped to this entry's `data-hc-id` attribute — write selectors relative to the component root:
|
|
208
|
-
|
|
209
|
-
```css
|
|
210
|
-
/* Responsive layout — use @media instead of tablet:/laptop: in rawHtml */
|
|
211
|
-
@media (min-width: 768px) {
|
|
212
|
-
.my-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
|
|
213
|
-
}
|
|
214
|
-
@media (min-width: 1024px) {
|
|
215
|
-
.my-card { flex-direction: row; }
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/* Hover and pseudo-elements */
|
|
219
|
-
.my-card:hover {
|
|
220
|
-
transform: translateY(-4px);
|
|
221
|
-
transition: transform 0.2s ease;
|
|
222
|
-
}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
Never redeclare colours or typography in `customCss` — those already exist as Tailwind classes.
|
|
226
|
-
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
## Custom JavaScript (`customJs`)
|
|
230
|
-
|
|
231
|
-
The renderer automatically injects a `hcRoot` variable pointing to this component's own `[data-hc-id]` element before your script runs. **Always use `hcRoot` as the root for DOM queries** — never `document.querySelector('[data-hc-id]')`, which matches the first component on the page, not this one.
|
|
232
|
-
|
|
233
|
-
```js
|
|
234
|
-
// ✓ Correct — hcRoot is scoped to this component automatically
|
|
235
|
-
var btns = hcRoot.querySelectorAll('.my-btn');
|
|
236
|
-
btns.forEach(function (btn) {
|
|
237
|
-
btn.addEventListener('click', function () {
|
|
238
|
-
// toggle state…
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
// ✗ Wrong — querySelector matches the FIRST [data-hc-id] on the page
|
|
243
|
-
var section = document.querySelector('[data-hc-id]');
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
**Rules:**
|
|
247
|
-
- Use `hcRoot.querySelector` / `hcRoot.querySelectorAll` for all DOM lookups.
|
|
248
|
-
- Keep scripts small and self-contained — no module imports, no global state.
|
|
249
|
-
- Avoid `document.getElementById` unless the ID is guaranteed unique across the whole page.
|
|
250
|
-
- Default `scriptStrategy` is `afterInteractive` — runs after page hydration. Use `lazyOnload` for non-critical third-party widgets.
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
|
|
254
|
-
## Common Patterns
|
|
255
|
-
|
|
256
|
-
All patterns use the mandatory two-layer grid structure.
|
|
257
|
-
|
|
258
|
-
### Centered text block
|
|
259
|
-
|
|
260
|
-
```html
|
|
261
|
-
<div class="w-full container-cols-grid container-rows-grid container-row-6-12">
|
|
262
|
-
<div class="col-start-2 col-span-1 row-start-2 row-span-4 content-cols-grid">
|
|
263
|
-
<div class="col-span-full laptop:col-start-2 laptop:col-span-10 flex flex-col gap-6">
|
|
264
|
-
<h2 class="h2">Section Heading</h2>
|
|
265
|
-
<div class="rtf-standard">
|
|
266
|
-
<p>Body copy goes here.</p>
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
</div>
|
|
270
|
-
</div>
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
### Two-column (text + image)
|
|
274
|
-
|
|
275
|
-
```html
|
|
276
|
-
<div class="w-full container-cols-grid container-rows-grid container-row-6-12">
|
|
277
|
-
<div class="col-start-2 col-span-1 row-start-2 row-span-4 content-cols-grid">
|
|
278
|
-
<div class="col-span-full laptop:col-start-2 laptop:col-span-4 flex flex-col gap-6">
|
|
279
|
-
<h2 class="h2">Heading</h2>
|
|
280
|
-
<p class="p1">Supporting description.</p>
|
|
281
|
-
</div>
|
|
282
|
-
<div class="col-span-full laptop:col-start-7 laptop:col-span-5">
|
|
283
|
-
<img src="..." alt="..." class="w-full rounded-lg" />
|
|
284
|
-
</div>
|
|
285
|
-
</div>
|
|
286
|
-
</div>
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
Note: the two columns stack on mobile by default. To flip to side-by-side on tablet, use `customCss`:
|
|
290
|
-
```css
|
|
291
|
-
@media (min-width: 768px) {
|
|
292
|
-
/* If you need column layout earlier than laptop, use customCss @media */
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### Coloured card
|
|
297
|
-
|
|
298
|
-
```html
|
|
299
|
-
<div class="w-full container-cols-grid container-rows-grid container-row-6-12">
|
|
300
|
-
<div class="col-start-2 col-span-1 row-start-2 row-span-4 content-cols-grid">
|
|
301
|
-
<div class="col-span-full laptop:col-start-2 laptop:col-span-10">
|
|
302
|
-
<div class="bg-orange text-dark p-8 rounded-lg flex flex-col gap-4">
|
|
303
|
-
<h3 class="h3">Card Title</h3>
|
|
304
|
-
<p class="p2">Supporting text.</p>
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
</div>
|
|
308
|
-
</div>
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### Hero (set `isHero: true`, `fullWidth: true`)
|
|
312
|
-
|
|
313
|
-
With `fullWidth: true` the outer grid is removed — you control the full viewport width directly:
|
|
314
|
-
|
|
315
|
-
```html
|
|
316
|
-
<!-- fullWidth: true → no outer grid, you own the full width -->
|
|
317
|
-
<div class="bg-dark text-light w-full">
|
|
318
|
-
<div class="content-cols-grid py-16">
|
|
319
|
-
<div class="col-span-full laptop:col-start-2 laptop:col-span-10 flex flex-col gap-8">
|
|
320
|
-
<h1 class="h1">Hero Heading</h1>
|
|
321
|
-
<p class="p1">Subtitle or intro text.</p>
|
|
322
|
-
</div>
|
|
323
|
-
</div>
|
|
324
|
-
</div>
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
---
|
|
328
|
-
|
|
329
|
-
## Images
|
|
330
|
-
|
|
331
|
-
**Do not hardcode Contentful CDN URLs in `rawHtml`.** If the asset is deleted or re-uploaded, the image silently breaks and the CMS has no record of the dependency.
|
|
332
|
-
|
|
333
|
-
For images in `rawHtml`, use a plain `<img>` tag with Contentful's image transformation API for basic optimisation:
|
|
334
|
-
|
|
335
|
-
```html
|
|
336
|
-
<img
|
|
337
|
-
src="https://images.ctfassets.net/…/image.jpg?w=800&fm=webp&fit=fill"
|
|
338
|
-
srcset="
|
|
339
|
-
https://images.ctfassets.net/…/image.jpg?w=400&fm=webp&fit=fill 400w,
|
|
340
|
-
https://images.ctfassets.net/…/image.jpg?w=800&fm=webp&fit=fill 800w,
|
|
341
|
-
https://images.ctfassets.net/…/image.jpg?w=1200&fm=webp&fit=fill 1200w
|
|
342
|
-
"
|
|
343
|
-
sizes="(max-width: 768px) 100vw, 50vw"
|
|
344
|
-
alt="Descriptive alt text"
|
|
345
|
-
class="w-full rounded-lg"
|
|
346
|
-
loading="lazy"
|
|
347
|
-
/>
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
**Trade-off:** A plain `<img>` does not use Next.js `<Image>` optimisation (no automatic WebP conversion, no LQIP placeholder, no automatic `srcset`). The Contentful image API partially compensates — append `?fm=webp` to serve WebP, `?w=N` to resize, and `?fit=fill` to crop. Always add `loading="lazy"` manually.
|
|
351
|
-
|
|
352
|
-
**Rules:**
|
|
353
|
-
- Always include a descriptive `alt` attribute. Decorative images use `alt=""`.
|
|
354
|
-
- Prefer managing images via a CMS asset field where possible — that creates a tracked dependency. Use `rawHtml` images only for layout-specific embedding that can't be achieved via component fields.
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
## Iteration Expectation
|
|
359
|
-
|
|
360
|
-
**Authoring `rawHtml` without live preview requires iteration.** Expect 4–8 rounds of save → screenshot → fix for a multi-section page. This is normal, not a sign of failure. Approach each round with a focus:
|
|
361
|
-
|
|
362
|
-
1. **Structure** — does the two-layer grid produce correct page margins?
|
|
363
|
-
2. **Spacing** — are sections spaced correctly vertically?
|
|
364
|
-
3. **Responsive** — do cards/columns lay out correctly at tablet and laptop widths?
|
|
365
|
-
4. **Interactions** — if there's JavaScript, does it work correctly?
|
|
366
|
-
|
|
367
|
-
---
|
|
368
|
-
|
|
369
|
-
## Checklist Before Saving
|
|
370
|
-
|
|
371
|
-
> **Visual verification is mandatory**, not optional. Tailwind JIT failures and grid structure issues are invisible without a rendered view. Take a screenshot and check before marking done.
|
|
372
|
-
|
|
373
|
-
- [ ] `cmsLabel` is set to a descriptive, unique value (not the default "New Hero" etc.)
|
|
374
|
-
- [ ] `rawHtml` uses only confirmed-safe Tailwind classes — no inline `style=` for colours/typography/layout
|
|
375
|
-
- [ ] All colour references use named classes (`text-dark`, `bg-orange`), not hex values
|
|
376
|
-
- [ ] Typography uses named classes (`h2`, `p1`), not raw `text-[Npx]`
|
|
377
|
-
- [ ] Content uses the two-layer grid structure (`container-cols-grid` outer + `content-cols-grid` inner)
|
|
378
|
-
- [ ] Responsive layout not covered by the Confirmed Safe list uses `customCss` with `@media` queries (not raw `tablet:` / `laptop:` prefixes in `rawHtml`)
|
|
379
|
-
- [ ] Any Tailwind utility class not in the confirmed-safe list uses `customCss` instead
|
|
380
|
-
- [ ] `markdownContent` is filled with the plain-text equivalent for search indexing
|
|
381
|
-
- [ ] `isHero: true` if the HTML contains an `<h1>`
|
|
382
|
-
- [ ] `fullWidth: true` if the design needs an edge-to-edge background
|
|
383
|
-
- [ ] **Took a screenshot and reviewed the render — no layout bugs visible**
|
|
384
|
-
- [ ] **If interactive: tested the interaction in browser (toggles, tabs, JS)**
|
|
385
|
-
- [ ] Source files (`component.html`, `component.css`, `component.js`) saved to project directory, not `/tmp`
|
|
386
|
-
|
|
387
|
-
---
|
|
388
|
-
|
|
389
|
-
## Generating and Updating the Style Guide
|
|
390
|
-
|
|
391
|
-
The style guide is auto-generated and should be regenerated whenever the design system changes:
|
|
392
|
-
|
|
393
|
-
```bash
|
|
394
|
-
# From the app directory:
|
|
395
|
-
pnpm cms-generate-html-style-guide
|
|
396
|
-
|
|
397
|
-
# Then re-merge to include it in COMPONENT_GUIDELINES_FOR_LLM.md:
|
|
398
|
-
pnpm cms-guidelines:merge
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
The style guide is also regenerated automatically as part of the `update-cms-guidelines` workflow (Step 3 in `fresh` mode, or any time you run a merge step).
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
# Validation Prompt — Guideline vs Code
|
|
2
|
-
|
|
3
|
-
**Step 5.3 — LLM validation of a guideline fragment against the component source.**
|
|
4
|
-
|
|
5
|
-
Run as part of the generation pipeline (not CI). Heavy validation that checks completeness
|
|
6
|
-
and consistency before committing. It is acceptable for this to take time — correctness is
|
|
7
|
-
the priority.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## When to run
|
|
12
|
-
|
|
13
|
-
After Step 5.1 (generation) produces a guideline fragment, before committing. Feed the
|
|
14
|
-
fragment and the component source to this prompt.
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Prompt
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
You are validating a CMS component guideline fragment for accuracy and completeness.
|
|
22
|
-
|
|
23
|
-
You will be given:
|
|
24
|
-
1. The guideline fragment (markdown).
|
|
25
|
-
2. The component source file (TypeScript/React).
|
|
26
|
-
3. Supporting files: SizingInformation.ts, Section.tsx, mapping.md.
|
|
27
|
-
|
|
28
|
-
Your task: systematically check whether the guideline is COMPLETE and CONSISTENT with
|
|
29
|
-
the code. Produce a detailed report.
|
|
30
|
-
|
|
31
|
-
Guideline fragment:
|
|
32
|
-
<GUIDELINE_MARKDOWN>
|
|
33
|
-
|
|
34
|
-
Component source:
|
|
35
|
-
<COMPONENT_SOURCE>
|
|
36
|
-
|
|
37
|
-
SizingInformation.ts:
|
|
38
|
-
<SIZING_SOURCE>
|
|
39
|
-
|
|
40
|
-
Section.tsx:
|
|
41
|
-
<SECTION_SOURCE>
|
|
42
|
-
|
|
43
|
-
mapping.md (CMS field → app prop mapping):
|
|
44
|
-
<MAPPING_SOURCE>
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
Check the following and report each as PASS, FAIL, or N/A:
|
|
49
|
-
|
|
50
|
-
1. FIELDS COVERAGE
|
|
51
|
-
- Are all fields in USED_FIELDS mentioned in the "Used fields" table?
|
|
52
|
-
- Are any fields mentioned in the table that are NOT in USED_FIELDS?
|
|
53
|
-
|
|
54
|
-
2. FIELD DESCRIPTIONS
|
|
55
|
-
- For each field in the table: is the "Effect when set" accurate?
|
|
56
|
-
- For each field in the table: is the "Effect when empty/removed" accurate?
|
|
57
|
-
- Are any effects described that do not match the code?
|
|
58
|
-
|
|
59
|
-
3. TYPOGRAPHY
|
|
60
|
-
- Does the guideline state the correct typography class for each element?
|
|
61
|
-
(e.g. heading = h4, body = p3)
|
|
62
|
-
- Does it correctly describe which HTML element the heading renders as
|
|
63
|
-
based on index (h1 for first, h2 for later)?
|
|
64
|
-
|
|
65
|
-
4. COLOUR BEHAVIOUR
|
|
66
|
-
- Does the guideline correctly describe how backgroundColour and textColour are applied
|
|
67
|
-
(section-wide, card-level, or neither)?
|
|
68
|
-
- Are the valid enum values for backgroundColour and textColour correct?
|
|
69
|
-
|
|
70
|
-
5. POSITION/INDEX BEHAVIOUR
|
|
71
|
-
- If the component uses getSizingInformation(index), does the guideline describe:
|
|
72
|
-
(a) the heading level change (h1 vs h2)?
|
|
73
|
-
(b) the spacing/padding change?
|
|
74
|
-
|
|
75
|
-
6. VARIANT DIFFERENCES
|
|
76
|
-
- If there are multiple registered variants (e.g. Hero and Hero Flipped), are they
|
|
77
|
-
all described, and are the differences accurately stated?
|
|
78
|
-
|
|
79
|
-
7. IMPACT SECTION
|
|
80
|
-
- Does the "Impact of content changes" section describe what happens when:
|
|
81
|
-
(a) important optional fields are added?
|
|
82
|
-
(b) important optional fields are removed?
|
|
83
|
-
- Are there missing impact scenarios that would be confusing to a user?
|
|
84
|
-
|
|
85
|
-
8. NO CODE REFERENCES
|
|
86
|
-
- Does the guideline contain any file path references (e.g. "Hero.tsx", "Section.tsx")?
|
|
87
|
-
- Does it contain any code beyond typography class names and colour names?
|
|
88
|
-
|
|
89
|
-
9. COMPLETENESS
|
|
90
|
-
- Is there anything important in the code that the guideline does NOT mention and SHOULD?
|
|
91
|
-
- List any missing items.
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
Output format:
|
|
96
|
-
|
|
97
|
-
## Validation Report — <ComponentType>
|
|
98
|
-
|
|
99
|
-
### Summary
|
|
100
|
-
PASS / FAIL / PARTIAL — one sentence overall verdict.
|
|
101
|
-
|
|
102
|
-
### Checks
|
|
103
|
-
|
|
104
|
-
| Check | Result | Detail |
|
|
105
|
-
|---|---|---|
|
|
106
|
-
| Fields coverage | PASS | All 10 used fields are in the table. |
|
|
107
|
-
| Field descriptions | FAIL | `visual` empty description says "copy-only" but should say "copy spans full width". |
|
|
108
|
-
| Typography | PASS | Heading h4, body p3 — correct. |
|
|
109
|
-
| Colour behaviour | PASS | Section-wide application described correctly. |
|
|
110
|
-
| Position/index | PASS | h1/h2 and padding described. |
|
|
111
|
-
| Variant differences | PASS | Hero Flipped column order described. |
|
|
112
|
-
| Impact section | PARTIAL | Removing preHeading described; removing body not described. |
|
|
113
|
-
| No code references | PASS | No file paths or raw code. |
|
|
114
|
-
| Completeness | PARTIAL | Animation behaviour (animate-when-seen) not mentioned. |
|
|
115
|
-
|
|
116
|
-
### Issues to fix
|
|
117
|
-
|
|
118
|
-
List each FAIL and PARTIAL item with a specific fix instruction:
|
|
119
|
-
- **Field: visual empty description** — change to: "Copy spans full section width on all breakpoints."
|
|
120
|
-
- **Impact: removing body** — add row: "Remove body → body block disappears; links follow directly after heading/subtitle."
|
|
121
|
-
- **Completeness: animation** — add to Behaviour section: "All text elements animate in when they scroll into view."
|
|
122
|
-
|
|
123
|
-
### Verdict
|
|
124
|
-
|
|
125
|
-
APPROVED — The guideline is complete and consistent. Minor fixes applied.
|
|
126
|
-
OR
|
|
127
|
-
NEEDS REVISION — Fix issues above before committing.
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## Acceptance criteria
|
|
133
|
-
|
|
134
|
-
**Approved if:**
|
|
135
|
-
- Fields coverage = PASS
|
|
136
|
-
- Typography = PASS
|
|
137
|
-
- Colour behaviour = PASS
|
|
138
|
-
- No code references = PASS
|
|
139
|
-
- No more than 2 PARTIAL items (and they are minor)
|
|
140
|
-
|
|
141
|
-
**Needs revision if:**
|
|
142
|
-
- Any FAIL item
|
|
143
|
-
- More than 2 PARTIAL items
|
|
144
|
-
|
|
145
|
-
When revision is needed: apply the specific fixes from the "Issues to fix" list and re-run
|
|
146
|
-
validation. Repeat until approved.
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Cursor agent task prompt
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
Validate the CMS guideline fragment for <COMPONENT_TYPE>.
|
|
154
|
-
|
|
155
|
-
Files to read:
|
|
156
|
-
- docs/cms-guidelines/components/<type-slug>.md (the guideline to validate)
|
|
157
|
-
- src/project/components/<TypeName>.tsx (source of truth)
|
|
158
|
-
- src/lib/SizingInformation.ts
|
|
159
|
-
- src/framework/Section.tsx
|
|
160
|
-
- generated/cms-discovery/mapping.md
|
|
161
|
-
|
|
162
|
-
Follow the validation prompt in validation-prompt.md.
|
|
163
|
-
Produce a validation report.
|
|
164
|
-
|
|
165
|
-
If APPROVED: proceed to merge.
|
|
166
|
-
If NEEDS REVISION: apply the specific fixes to docs/cms-guidelines/components/<type-slug>.md,
|
|
167
|
-
then re-validate (run this task again with the updated fragment).
|
|
168
|
-
When approved, run: pnpm run cms-guidelines:merge
|
|
169
|
-
Then commit both files.
|
|
170
|
-
```
|