Parse FunnelWind HTML to ClickFunnels PageTree JSON.
Requires cf-elements - This parser works on the rendered HTML output from cf-elements. The cf-elements package renders FunnelWind custom elements (like <cf-section>, <cf-headline>, <cf-button>) into the DOM structure that this parser reads.
npm install cf-pagetree-parserimport { parsePageTree } from 'cf-pagetree-parser';
// Parse to PageTree JSON (automatically finds ContentNode)
const pageTree = parsePageTree();
// The result is ready for ClickFunnels import
console.log(JSON.stringify(pageTree, null, 2));<script src="dist/cf-pagetree-parser.js"></script>
<script>
const { parsePageTree } = CFPageTreeParser;
// Automatically finds ContentNode in the document
const pageTree = parsePageTree();
</script>The dist/cf-pagetree-parser.js bundle can be used in sandboxed extension contexts.
parsePageTree(rootElement?)- Parse DOM to PageTree object. If no element provided, automatically finds ContentNode.exportPageTreeJSON(rootElement?, formatted?)- Export as JSON stringdownloadPageTree(filename?, rootElement?)- Download JSON filecopyPageTreeToClipboard(rootElement?)- Copy to clipboard
generateId()- Generate unique IDgenerateFractionalIndex(index)- Generate fractional index for orderingparseValueWithUnit(value, defaultUnit?)- Parse CSS value with unitnormalizeColor(color)- Normalize color to consistent formatparseInlineStyle(styleString)- Parse inline style string to object
parseShadow(shadowString)- Parse box-shadowshadowToParams(shadow)- Convert shadow to CF paramsparseBorder(styles)- Parse border stylesborderToParams(border)- Convert border to CF paramsparseBackground(styles)- Parse background stylesbackgroundToParams(background)- Convert background to CF params
The parser extracts page-level settings from cf-page attributes:
| Attribute | Description |
|---|---|
font |
Page font family (e.g., "Poppins"). Applied to body-level styles. |
color |
Default text color for all elements (default: #334155) |
text-color |
Alias for color |
link-color |
Default link color (default: #3b82f6) |
font-weight |
Default font weight |
css |
Custom CSS (URL-encoded) |
header-code |
Custom header HTML/scripts (URL-encoded) |
footer-code |
Custom footer HTML/scripts (URL-encoded) |
Font values are normalized to ClickFunnels format (e.g., "Poppins", sans-serif).
# Build standalone bundle
npm run build
# Output: dist/cf-pagetree-parser.jsMIT