I am creating a prompt to convert any given web page (via URL) to a Frappe Builder page.
My expectation is getting a JSON file which I can directly paste into ERPNext. These are the prompts I’ve tried and failed. Do you have any idea?
## Objective
Convert raw HTML source code into a structured JSON file that can be directly imported into Frappe Builder for web page creation.
## Conversion Rules and Guidelines
### 1. Structure Mapping
- Map HTML elements to Frappe Builder's component structure
- Preserve hierarchy and nesting of elements
- Convert CSS classes and inline styles to Frappe Builder's styling system
### 2. Component Identification
- Identify distinct sections of the webpage
- Convert major HTML elements to appropriate Frappe Builder components:
* `<div>` → Section or Container
* `<header>` → Header Section
* `<nav>` → Navigation Section
* `<main>` → Main Content Section
* `<footer>` → Footer Section
* `<img>` → Image Component
* `<h1>`, `<h2>`, etc. → Heading Component
* `<p>` → Text Component
* `<a>` → Link Component
* `<button>` → Button Component
* `<form>` → Form Section
* `<input>` → Form Input Component
### 3. Attribute and Style Conversion
- Convert HTML attributes to Frappe Builder properties
* `class` → Map to Frappe Builder's styling system
* `id` → Used as unique identifier
* `style` → Convert inline styles to component-specific styling
* `href` → Link destinations
* `src` → Image sources
### 4. Content Extraction
- Extract and preserve all text content
- Maintain original formatting and structure
- Handle nested elements and their content hierarchically
### 5. Semantic Understanding
- Analyze the overall purpose and layout of the webpage
- Suggest appropriate Frappe Builder page template
- Identify potential dynamic or interactive elements
## Conversion Process
1. Analyze Input HTML
- Parse the entire HTML document
- Break down into structural components
- Identify nested elements and their relationships
2. Component Mapping
- Match HTML elements to closest Frappe Builder components
- Create a hierarchical JSON representation
- Preserve original styling and attributes as closely as possible
3. JSON Structure Generation
- Create a JSON that follows Frappe Builder's schema
- Include all necessary metadata and component definitions
- Ensure the JSON is ready for direct import
## Example Conversion Template
```json
{
"page_name": "Generated Page",
"sections": [
{
"type": "section",
"components": [
{
"type": "heading",
"content": "Original H1 Text",
"properties": {
"style": {},
"classes": []
}
},
{
"type": "text",
"content": "Paragraph content",
"properties": {
"style": {},
"classes": []
}
}
]
}
]
}```
Special Handling Instructions
Preserve responsive design considerations
Handle media queries and responsive classes
Convert Bootstrap/Tailwind classes to equivalent Frappe Builder styles
Manage complex nested structures carefully ```