html-to-bricks
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHTML to Bricks Builder
HTML to Bricks Builder
Version: 1.1.0
Updated: 2026-08-04
Category: migration
Status: stable
Requires: Respira for WordPress plugin 7.1+ + Bricks Builder active + MCP server
Version: 1.1.0
Updated: 2026-08-04
分类: 迁移
状态: 稳定
依赖: Respira for WordPress plugin 7.1+ + Bricks Builder active + MCP server
Description
功能说明
Convert raw HTML/CSS — pasted from a design export, a Figma extraction, an existing landing page on another platform, or a competitor's source code — into native Bricks Builder elements. Not a screenshot-to-builder pass; this is a structural conversion that respects Bricks' element schemas, ACSS classes (if installed), and the site's design system.
Resolves [open feature request: HTML to Bricks Builder]. Uses the existing MCP tool, with a Bricks-specific workflow layered on top.
respira_convert_html_to_builder将从设计导出文件、Figma提取内容、其他平台现有落地页或竞品源代码中复制的原始HTML/CSS转换为原生Bricks Builder元素。这并非截图转构建器的简单转换,而是遵循Bricks元素架构、ACSS类(若已安装)及站点设计系统的结构化转换。
解决了[开放功能请求:HTML转Bricks Builder]。基于现有 MCP工具,叠加了Bricks专属工作流。
respira_convert_html_to_builderWhen to Use
使用场景
- A designer hands you HTML/CSS from a Webflow export, a Framer export, or a CodePen
- You're rebuilding a competitor's landing page (legally — don't copy proprietary work) and want to start from their structure
- You have an old static HTML page you want to bring into your live Bricks-powered site
- You're prototyping a section in HTML and want to land it in Bricks for further editing
- 设计师向你提供Webflow导出、Framer导出或CodePen的HTML/CSS文件
- 你需要重建竞品的落地页(合法操作——请勿复制专有内容),并希望从其结构开始
- 你有一个旧静态HTML页面,想要导入到正在运行的Bricks驱动站点中
- 你正在用HTML制作某个区块的原型,希望导入到Bricks中进行进一步编辑
Trigger Phrases
触发短语
- "convert this html to bricks"
- "import this design into bricks"
- "paste html into bricks"
- "html to bricks"
- "turn this html into a bricks page"
- "bring this codepen into bricks"
- "convert this html to bricks"
- "import this design into bricks"
- "paste html into bricks"
- "html to bricks"
- "turn this html into a bricks page"
- "bring this codepen into bricks"
Execution Workflow
执行工作流
Step 1 — Verify Bricks is active
步骤1 — 验证Bricks是否激活
Call . If the active builder is NOT Bricks, stop and tell the user: "This skill targets Bricks Builder. Your active builder is {X}. Use the generic workflow instead, or switch the active builder."
respira_get_builder_infoconvert html to builderIf Bricks is active, capture its version.
调用。若当前激活的构建器不是Bricks,则停止操作并告知用户:"此技能针对Bricks Builder。你当前激活的构建器是{X}。请改用通用的工作流,或切换激活的构建器。"
respira_get_builder_infoconvert html to builder若Bricks已激活,记录其版本。
Step 2 — Confirm site + target page
步骤2 — 确认站点及目标页面
Call . Ask:
respira_get_active_site- "Convert the HTML into a new page (I'll create it), or into an existing page (you tell me which)?"
- If existing: confirm the page ID and remind the user that a SafeEdit duplicate will be created.
调用。询问用户:
respira_get_active_site- "将HTML转换为新页面(我会创建它),还是导入到现有页面(请告知具体页面)?"
- 若选择现有页面:确认页面ID,并提醒用户将创建一个SafeEdit副本。
Step 3 — Pull design system if present
步骤3 — 提取设计系统(若存在)
Call . If present, capture colors, typography, spacing tokens. The conversion will map raw CSS values (e.g. ) to design system tokens (e.g. ) so the converted page is drift-resistant.
respira_get_option('respira_design_system')#2563EBprimary调用。若存在,提取颜色、排版、间距令牌。转换过程会将原始CSS值(如)映射到设计系统令牌(如),确保转换后的页面能跟随设计系统更新。
respira_get_option('respira_design_system')#2563EBprimaryStep 4 — Accept the HTML input
步骤4 — 接收HTML输入
Three input modes:
- Mode A — pasted in the conversation. The user pastes raw HTML directly.
- Mode B — URL. The user gives a public URL; fetch the HTML via WebFetch or . Do NOT silently re-host external assets; flag external images so the user can decide to mirror them.
/browse - Mode C — file. The user uploads or references a local HTML file path.
In all modes, also accept inline blocks and external references. For external stylesheets, fetch their text content.
<style><link rel=stylesheet>三种输入模式:
- 模式A — 对话中粘贴:用户直接粘贴原始HTML内容。
- 模式B — URL链接:用户提供公开URL;通过WebFetch或获取HTML内容。请勿静默托管外部资源;标记外部图片,由用户决定是否镜像。
/browse - 模式C — 文件:用户上传或引用本地HTML文件路径。
所有模式均支持内联块和外部引用。对于外部样式表,需获取其文本内容。
<style><link rel=stylesheet>Step 5 — Run the conversion
步骤5 — 执行转换
Call with , the HTML, the CSS, and the design-system context.
respira_convert_html_to_builderbuilder=bricksThe MCP tool returns a Bricks element tree. Each element has a (Bricks element type — , , , , , , , etc.) and matching the Bricks schema.
namesectionblockcontainerheadingtext-basicbuttonimagesettingsThe conversion also registers the colors and typography it carries as named design tokens in Bricks' own global styles, and the converted elements reference those tokens instead of carrying value copies. When refining afterwards, reuse the registered tokens ( shows them) rather than re-inlining raw hex values or font stacks — and mention the registration, token names and counts, when you report the conversion done.
respira_list_design_tokens调用,传入参数、HTML内容、CSS内容及设计系统上下文。
respira_convert_html_to_builderbuilder=bricksMCP工具会返回Bricks元素树。每个元素包含(Bricks元素类型——、、、、、、等)和符合Bricks架构的。
namesectionblockcontainerheadingtext-basicbuttonimagesettings转换过程还会将识别到的颜色和排版注册为Bricks全局样式中的命名设计令牌,转换后的元素会引用这些令牌而非直接使用原始值。转换完成后,告知用户令牌已注册、令牌名称及数量,后续优化时请使用已注册的令牌(可通过查看),而非重新内嵌原始十六进制值或字体栈。
respira_list_design_tokensStep 6 — Map raw values to design system tokens
步骤6 — 将原始值映射到设计系统令牌
For each element in the tree:
- If is a hex value matching one of the design system colors, replace with a token reference
settings.color - If matches the design system heading or body family, replace with a token reference
settings.typography.font-family - If ,
settings.padding,settings.marginare pixel values matching the design system spacing scale, replace with token referencessettings.gap
This step is the difference between a one-off conversion and a maintainable page. After the conversion, if the user updates the design system, the converted page reflects it.
针对元素树中的每个元素:
- 若是与设计系统颜色匹配的十六进制值,替换为令牌引用
settings.color - 若与设计系统的标题或正文字体匹配,替换为令牌引用
settings.typography.font-family - 若、
settings.padding、settings.margin是与设计系统间距刻度匹配的像素值,替换为令牌引用settings.gap
此步骤是一次性转换与可维护页面的核心区别。转换完成后,若用户更新设计系统,转换后的页面会自动同步更新。
Step 7 — ACSS class mapping (if ACSS detected)
步骤7 — ACSS类映射(若检测到ACSS)
Call or check the active theme for ACSS. If ACSS is installed:
respira_get_option('automatic_css_settings')- Map common CSS patterns to ACSS classes
- → ACSS section padding utility
padding: 96px 24px - → ACSS container class
max-width: 1280px; margin: 0 auto - Heading font sizes → ACSS heading scale classes
This is optional and gated on ACSS being present. If ACSS isn't installed, fall through to inline settings.
调用或检查当前主题是否安装ACSS。若已安装ACSS:
respira_get_option('automatic_css_settings')- 将常见CSS模式映射为ACSS类
- → ACSS区块间距工具类
padding: 96px 24px - → ACSS容器类
max-width: 1280px; margin: 0 auto - 标题字号 → ACSS标题刻度类
此步骤为可选操作,仅在ACSS已安装时执行。若未安装ACSS,则使用内嵌设置。
Step 8 — Inject into the page
步骤8 — 导入到页面
For a new page: call with the Bricks element tree as the page body.
respira_build_pageFor an existing page: call first (SafeEdit), then against the duplicate.
respira_create_page_duplicaterespira_inject_builder_contentOutput the new (or duplicate) page URL.
若为新页面:调用,将Bricks元素树作为页面主体。
respira_build_page若为现有页面:先调用(SafeEdit),再针对副本调用。
respira_create_page_duplicaterespira_inject_builder_content输出新页面(或副本页面)的URL。
Step 9 — Verify
步骤9 — 验证
Open the new page in the Bricks editor (the URL pattern is ). Visually verify:
/?bricks=run&page_id={id}- All sections render
- Typography looks correct
- Colors map to design system tokens
- Spacing is consistent
- Images load (warn if any external image URLs were preserved unmirrored)
If anything is off, the user can refine in the Bricks editor directly. Common issues to flag:
- HTML elements Bricks doesn't have a 1:1 mapping for (e.g. collapsible → mapped to Bricks accordion)
<details> - Forms — HTML doesn't convert into Bricks Form element 1:1. Flag and ask the user to wire the form fields manually.
<form> - Custom animations — CSS keyframes don't convert. Flag.
在Bricks编辑器中打开新页面(URL格式为),进行视觉验证:
/?bricks=run&page_id={id}- 所有区块正常渲染
- 排版显示正确
- 颜色映射到设计系统令牌
- 间距保持一致
- 图片正常加载(若保留了未镜像的外部图片URL,需向用户发出警告)
若存在问题,用户可直接在Bricks编辑器中优化。需标记的常见问题:
- Bricks无法一对一映射的HTML元素(如折叠组件→映射为Bricks手风琴组件)
<details> - 表单——HTML 无法一对一转换为Bricks Form元素。需标记并请用户手动配置表单字段。
<form> - 自定义动画——CSS关键帧无法转换。需标记。
Hard rules
硬性规则
- Bricks-only. This skill is locked to Bricks. For other builders, use the generic workflow.
convert_html_to_builder - Never inject HTML directly into the page body. If the conversion can't map an HTML element to a Bricks element, the skill must report the failure and let the user decide. Do not fall back to a "code block" element that pastes raw HTML — that recreates the do-not-write-raw-HTML failure mode.
- External assets are flagged, not mirrored. Don't silently download external images and side-load them. Flag them so the user explicitly decides to mirror.
- Always SafeEdit on existing pages. Never convert HTML into a live page directly. Duplicate first.
- Design system tokens take precedence over raw values. When a CSS hex matches a design system color, use the token. Always.
- 仅支持Bricks:此技能仅针对Bricks。若使用其他构建器,请改用通用的工作流。
convert_html_to_builder - 禁止直接注入HTML到页面主体:若无法将HTML元素映射为Bricks元素,技能必须报告失败并由用户决定后续操作。请勿退化为使用“代码块”元素粘贴原始HTML——这会回到“请勿编写原始HTML”的错误模式。
- 外部资源仅标记,不镜像:请勿静默下载外部图片并加载。需标记外部资源,由用户明确决定是否镜像。
- 现有页面必须使用SafeEdit:禁止直接将HTML转换到已上线页面。必须先创建副本。
- 设计系统令牌优先于原始值:当CSS十六进制值与设计系统颜色匹配时,必须使用令牌。
Telemetry
遥测
Records: site URL hash, Bricks version, HTML input size (bytes), elements converted count, design system bound, ACSS detected, success/failure, total duration. No HTML content, no element names, no page IDs sent.
Endpoint:
POST https://www.respira.press/api/skills/track-usage记录内容:站点URL哈希、Bricks版本、HTML输入大小(字节)、转换元素数量、是否绑定设计系统、是否检测到ACSS、转换成功/失败、总耗时。不会发送HTML内容、元素名称或页面ID。
端点:
POST https://www.respira.press/api/skills/track-usage