diff --git a/docs/tasks/ghost-page-builder/gemini-consultation.md b/docs/tasks/ghost-page-builder/gemini-consultation.md new file mode 100644 index 0000000..76f957d --- /dev/null +++ b/docs/tasks/ghost-page-builder/gemini-consultation.md @@ -0,0 +1,337 @@ +# Gemini Consultation: Ghost Page Builder Architecture + +**Date:** March 22, 2026 +**Session:** Chronicler #39 +**Tool:** Task #70 - Ghost Page Builder +**Consultation Duration:** ~20 minutes +**Pattern:** Following The Translator's Gemini Collaboration Pattern + +--- + +## CONTEXT + +Building an interactive React tool for live preview of Ghost CMS page HTML with Fire/Frost CSS before publishing. Current workflow (write → paste → preview → edit → repeat) wastes significant time. + +**Challenge:** Single `.jsx` artifact (no build step) with: +- Live HTML editor +- Real-time preview with custom CSS +- Ghost CMS compatibility +- Viewport testing (mobile/tablet/desktop) + +--- + +## CONSULTATION QUESTIONS + +Sent to Gemini for architectural guidance: + +1. **Preview Architecture:** Iframe vs other approaches? CSS injection strategy? +2. **Syntax Highlighting:** CodeMirror vs simpler textarea? +3. **React State:** Best pattern for live updates + localStorage? +4. **Mobile Preview:** How to implement viewport toggling? +5. **Gotchas:** What breaks with iframe-based preview? + +--- + +## GEMINI'S KEY RECOMMENDATIONS + +### 1. Use `srcdoc` Attribute for Preview + +**Gemini's Guidance:** +> "Use the iframe's `srcdoc` attribute. It is declarative, plays perfectly with React's state paradigm, and avoids cross-origin headaches because the browser treats it as same-origin by default." + +**Why This Matters:** +- Avoids direct document manipulation +- Works seamlessly with React state +- No CORS issues +- Clean separation of concerns + +**Implementation:** +```javascript +const generatePreviewHtml = (htmlContent) => { + return ` + + + + + + + + + + +
+ ${htmlContent} +
+ +`; +}; +``` + +### 2. CSS Injection Order Critical + +**Gemini's Guidance:** +> "CSS Injection Order: 1. Ghost Theme CSS (Source v1.5.2), 2. Ghost Site-wide Head Injection (if separate), 3. Fire/Frost Custom CSS (This ensures your custom brand gradients override defaults)." + +**Why This Matters:** +- Fire/Frost CSS must come LAST to override Ghost defaults +- Order affects gradient rendering +- Ensures brand consistency + +### 3. Ghost Wrapper Classes Required + +**Gemini's Critical Insight:** +> "Ghost uses specific wrapper classes (like `.gh-content` or `.kg-canvas`) to apply styling to inner HTML. If you don't wrap your injected HTML in those exact classes within your `srcdoc` template, the typography and spacing won't match the live site." + +**Why This Matters:** +- Without `.gh-body` and `.gh-content`, preview won't match Ghost +- Typography, spacing, and layout depend on these classes +- Must be included in ALL sample templates + +**Impact:** This prevented hours of "why doesn't my preview match Ghost?" debugging. + +### 4. Skip CodeMirror, Use Styled Textarea + +**Gemini's Guidance:** +> "CodeMirror is incredibly powerful, but getting v6 to work nicely inside a single-file, no-build React artifact (like a Claude Artifact) usually requires messy CDN imports and complex `useEffect` hooks to bind the editor to the DOM. It frequently breaks. For simple HTML editing, a well-styled `