@se-studio/contentful-cms 1.0.43 → 1.0.45
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/package.json +1 -1
- package/skills/alt-text-audit/SKILL.md +0 -60
- package/skills/cms-guidelines/README.md +0 -166
- package/skills/cms-guidelines/colour-hint-prompt.md +0 -77
- package/skills/cms-guidelines/evaluation-prompt.md +0 -84
- package/skills/cms-guidelines/generate-component-guidelines.md +0 -126
- package/skills/cms-guidelines/generation-prompt.md +0 -231
- package/skills/cms-guidelines/html-component-authoring.md +0 -401
- package/skills/cms-guidelines/validation-prompt.md +0 -170
- package/skills/cms-guidelines/variant-loop.md +0 -189
- package/skills/cms-guidelines/variant-proposal-prompt.md +0 -131
- package/skills/core/SKILL.md +0 -793
- package/skills/image-guide/SKILL.md +0 -240
- package/skills/manifest.json +0 -11
- package/skills/navigation/SKILL.md +0 -23
- package/skills/rich-text/SKILL.md +0 -96
- package/skills/schema-org/SKILL.md +0 -74
- package/skills/screenshots/SKILL.md +0 -46
- package/skills/seo-descriptions/SKILL.md +0 -54
- package/skills/templates/SKILL.md +0 -21
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
# Generation Prompt — Code + Screenshots → Guideline Block
|
|
2
|
-
|
|
3
|
-
**Step 5.1 — Multi-step prompts for generating one guideline fragment.**
|
|
4
|
-
|
|
5
|
-
Run as a **Cursor agent task**. The agent reads the component source, screenshots, and field
|
|
6
|
-
metadata, then writes a self-contained markdown guideline fragment in the target format.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Inputs
|
|
11
|
-
|
|
12
|
-
| Input | Source |
|
|
13
|
-
|---|---|
|
|
14
|
-
| Component source file | `src/project/components/<TypeName>.tsx` |
|
|
15
|
-
| Field metadata (used fields + types + enums) | `generated/cms-discovery/field-list.json` |
|
|
16
|
-
| Project theme (palette + typography + grid) | `generated/cms-discovery/theme-context.md` |
|
|
17
|
-
| Accepted screenshots | `generated/cms-discovery/accepted-variants/{components\|collections\|externals}/<type-slug>.json` + image files |
|
|
18
|
-
| Target format example | `tmp/component-guidelines-target-format.md` (Hero example) |
|
|
19
|
-
| Mapping reference | `generated/cms-discovery/mapping.md` |
|
|
20
|
-
| SizingInformation source | `src/lib/SizingInformation.ts` |
|
|
21
|
-
| Section wrapper source | `src/framework/Section.tsx` (for backgroundColour/textColour behaviour) |
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Step 1 of 3 — Describe the screenshots
|
|
26
|
-
|
|
27
|
-
**Prompt:**
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
You are documenting a CMS component for a marketing site.
|
|
31
|
-
|
|
32
|
-
I will give you screenshots of the component in different states, and the component's
|
|
33
|
-
accepted variant list. Describe what you see in each screenshot.
|
|
34
|
-
|
|
35
|
-
Component: <COMPONENT_TYPE>
|
|
36
|
-
|
|
37
|
-
Accepted variants (from accepted-variants/{components|collections|externals}/<type-slug>.json):
|
|
38
|
-
<ACCEPTED_VARIANTS_JSON>
|
|
39
|
-
|
|
40
|
-
Project theme (from generated/cms-discovery/theme-context.md):
|
|
41
|
-
<THEME_CONTEXT>
|
|
42
|
-
|
|
43
|
-
For each variant, describe:
|
|
44
|
-
- The visual layout (columns, stack, full-width, etc.)
|
|
45
|
-
- The elements visible (heading, eyebrow, body, links, visual/image, background colour)
|
|
46
|
-
- The typography appearance (large heading, small body text, etc.)
|
|
47
|
-
- The colour scheme (background colour, text colour, whether the visual is tinted)
|
|
48
|
-
- Anything notable (animations not applicable in screenshots, spacing gaps, alignment)
|
|
49
|
-
|
|
50
|
-
Be precise. Write one short paragraph per variant (3–5 sentences). No code references.
|
|
51
|
-
Only use colour names from the site palette (listed in the theme context above) and
|
|
52
|
-
typography class names (h1–h6, p2, p3 etc. from the typography scale above).
|
|
53
|
-
|
|
54
|
-
Output format: one section per variant, headed by ## <label>.
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Step 2 of 3 — Extract behaviour and fields from code
|
|
60
|
-
|
|
61
|
-
**Prompt:**
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
You are writing CMS component documentation.
|
|
65
|
-
|
|
66
|
-
I will give you the source code of a Next.js component. Extract all behaviour
|
|
67
|
-
rules for the documentation. Do NOT quote or reference the code — translate
|
|
68
|
-
the code behaviour into plain English rules that a non-developer can follow.
|
|
69
|
-
|
|
70
|
-
Component source:
|
|
71
|
-
<COMPONENT_SOURCE>
|
|
72
|
-
|
|
73
|
-
SizingInformation.ts source (shows how index affects heading level and section spacing):
|
|
74
|
-
<SIZING_INFORMATION_SOURCE>
|
|
75
|
-
|
|
76
|
-
Section.tsx source (shows how backgroundColour and textColour are applied):
|
|
77
|
-
<SECTION_SOURCE>
|
|
78
|
-
|
|
79
|
-
Field mapping reference (mapping.md — shows how CMS fields map to app props):
|
|
80
|
-
<MAPPING_SOURCE>
|
|
81
|
-
|
|
82
|
-
Project theme (palette, typography, grid from generated/cms-discovery/theme-context.md):
|
|
83
|
-
<THEME_CONTEXT>
|
|
84
|
-
|
|
85
|
-
Extract and write:
|
|
86
|
-
1. FIELDS: For each field in USED_FIELDS, write one row: field name, type, what it does when
|
|
87
|
-
set, what happens when it is empty. Use only typography class names and colour names as
|
|
88
|
-
code snippets. No file paths.
|
|
89
|
-
2. BEHAVIOUR: Any behaviour that depends on position (index), variant (flipped), or other
|
|
90
|
-
logic. E.g. "When this is the first block on the page, the heading renders as <h1>".
|
|
91
|
-
3. IMPACT: What visually changes when content changes (longer text, add/remove visual, etc.).
|
|
92
|
-
4. TYPOGRAPHY: Which typography classes (h1–h6, p2, p3, h4, etc.) are applied to each element.
|
|
93
|
-
5. COLOUR APPLICATION: How backgroundColour and textColour are applied. Section-wide? Per-card?
|
|
94
|
-
|
|
95
|
-
Output each section clearly labelled (## Fields, ## Behaviour, ## Impact, ## Typography,
|
|
96
|
-
## Colour Application). No code blocks. No file references. Plain English only (except
|
|
97
|
-
typography class names and colour names).
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Step 3 of 3 — Merge into guideline block
|
|
103
|
-
|
|
104
|
-
**Prompt:**
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
You are writing a self-contained CMS component guideline fragment.
|
|
108
|
-
|
|
109
|
-
Below are two inputs:
|
|
110
|
-
A) Screenshot descriptions for each variant of <COMPONENT_TYPE>.
|
|
111
|
-
B) Extracted behaviour rules from the source code.
|
|
112
|
-
|
|
113
|
-
Also provided:
|
|
114
|
-
- The target format example (Hero guideline from tmp/component-guidelines-target-format.md).
|
|
115
|
-
- The field list from generated/cms-discovery/field-list.json.
|
|
116
|
-
- The project theme from generated/cms-discovery/theme-context.md (palette names + typography scale).
|
|
117
|
-
- The screenshot index from docs/cms-guidelines/screenshots/index.json (lists captured screenshots).
|
|
118
|
-
- The app's devBaseUrl from .contentful-cms.json (e.g. "http://localhost:3010").
|
|
119
|
-
|
|
120
|
-
Produce a single markdown fragment for <COMPONENT_TYPE> following EXACTLY this structure:
|
|
121
|
-
|
|
122
|
-
# <ComponentType>
|
|
123
|
-
(one-line summary of what it is and when to use it)
|
|
124
|
-
|
|
125
|
-
## Screenshots
|
|
126
|
-
|
|
127
|
-
(For each accepted variant that has a captured screenshot in index.json, include an image link.
|
|
128
|
-
Use the devBaseUrl from .contentful-cms.json for the host.
|
|
129
|
-
Use the `file` field from index.json VERBATIM as the ?file= value — it may include a subdirectory
|
|
130
|
-
prefix such as `components/` or `collections/`. Do NOT reconstruct the path from the type slug. Format:)
|
|
131
|
-
|
|
132
|
-
| Variant | Preview |
|
|
133
|
-
|---------|---------|
|
|
134
|
-
| Default |  |
|
|
135
|
-
| Navy |  |
|
|
136
|
-
|
|
137
|
-
(Only include variants present in index.json. If no screenshots exist, write: "No screenshots captured yet. Run cms-capture-screenshots to generate them.")
|
|
138
|
-
|
|
139
|
-
## What it looks like
|
|
140
|
-
(describe layout, columns, stacking, visible elements — based on screenshot descriptions)
|
|
141
|
-
|
|
142
|
-
## Typography
|
|
143
|
-
(typography classes for heading, body, subtitle — bullets only)
|
|
144
|
-
|
|
145
|
-
## Colours
|
|
146
|
-
(how backgroundColour/textColour apply — section-wide? per-card? valid palette values)
|
|
147
|
-
|
|
148
|
-
## Used fields
|
|
149
|
-
(table: Field | Type | Effect when set | Effect when empty/removed)
|
|
150
|
-
|
|
151
|
-
## Behaviour
|
|
152
|
-
(position/index rules, variant differences, anything that depends on content logic)
|
|
153
|
-
|
|
154
|
-
## Impact of content changes
|
|
155
|
-
(table or bullets: what changes when you add/remove/change specific fields)
|
|
156
|
-
|
|
157
|
-
Rules:
|
|
158
|
-
- SELF-CONTAINED. A reader with no code access must fully understand the component.
|
|
159
|
-
- No source code references, no file paths, no "see Hero.tsx".
|
|
160
|
-
- Only use typography class names (from theme-context.md, e.g. h1–h6, p2, p3) and colour
|
|
161
|
-
names (from theme-context.md palette) as code-like snippets. Everything else is plain English.
|
|
162
|
-
- For the ## Colours section, list the valid palette colour names from theme-context.md — do
|
|
163
|
-
NOT invent colour names or describe them generically.
|
|
164
|
-
- If a field is listed in USED_FIELDS but has no visual effect when empty, say
|
|
165
|
-
"No visible effect when empty" in the table.
|
|
166
|
-
- Collections: add a section for card-level fields and describe how the number of cards
|
|
167
|
-
affects layout.
|
|
168
|
-
- External components: omit screenshots and the Screenshots section; describe parameters instead.
|
|
169
|
-
- Screenshot links use the devBaseUrl from .contentful-cms.json — they resolve when the dev
|
|
170
|
-
server is running and are useful for both human reviewers and AI assistants.
|
|
171
|
-
|
|
172
|
-
Output raw markdown only. Start with "# <ComponentType>". No preamble.
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
|
|
177
|
-
## External component variant
|
|
178
|
-
|
|
179
|
-
For external components (no showcase), replace Step 1 with:
|
|
180
|
-
|
|
181
|
-
```
|
|
182
|
-
The component has no screenshots (not yet in the showcase). Instead, describe what
|
|
183
|
-
the component likely looks like based on its name and parameters alone. Mark this
|
|
184
|
-
section with a note: "(Visual description estimated from code; no screenshots available.)"
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
All other steps are the same.
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## After generation
|
|
192
|
-
|
|
193
|
-
After the LLM produces the fragment:
|
|
194
|
-
|
|
195
|
-
1. Save to `docs/cms-guidelines/components/<type-slug>.md`
|
|
196
|
-
(or `collections/` or `externals/` as appropriate).
|
|
197
|
-
2. Run validation (Step 5.3 prompt).
|
|
198
|
-
3. If validation passes, run merge: `pnpm run cms-guidelines:merge`
|
|
199
|
-
4. Commit both files.
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
## Cursor agent task prompt
|
|
204
|
-
|
|
205
|
-
```
|
|
206
|
-
Generate the CMS guideline fragment for <COMPONENT_TYPE>.
|
|
207
|
-
|
|
208
|
-
Files to read:
|
|
209
|
-
- src/project/components/<TypeName>.tsx (or collections/<TypeName>.tsx)
|
|
210
|
-
- generated/cms-discovery/field-list.json
|
|
211
|
-
- generated/cms-discovery/theme-context.md (palette + typography + grid — use for all colour and font references)
|
|
212
|
-
- generated/cms-discovery/mapping.md
|
|
213
|
-
- generated/cms-discovery/accepted-variants/{components|collections|externals}/<type-slug>.json
|
|
214
|
-
- docs/cms-guidelines/screenshots/index.json (to know which screenshots exist)
|
|
215
|
-
- .contentful-cms.json (to get devBaseUrl for screenshot links)
|
|
216
|
-
- src/lib/SizingInformation.ts
|
|
217
|
-
- src/framework/Section.tsx
|
|
218
|
-
- tmp/component-guidelines-target-format.md (example format)
|
|
219
|
-
|
|
220
|
-
Images to analyse:
|
|
221
|
-
- docs/cms-guidelines/screenshots/<type-slug>-*.png (all accepted variant screenshots)
|
|
222
|
-
|
|
223
|
-
Follow the three-step generation process in generation-prompt.md:
|
|
224
|
-
1. Describe screenshots.
|
|
225
|
-
2. Extract behaviour from code.
|
|
226
|
-
3. Merge into guideline fragment (include ## Screenshots section with image links using devBaseUrl).
|
|
227
|
-
|
|
228
|
-
Save the output to docs/cms-guidelines/components/<type-slug>.md.
|
|
229
|
-
Then run: pnpm run cms-guidelines:merge
|
|
230
|
-
Then commit: git add docs/cms-guidelines/ && git commit -m "chore(bl): generate guideline for <TypeName>"
|
|
231
|
-
```
|
|
@@ -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).
|