UI Builder compiler
F.uibuildercompiler().
On this page
API
method
F.uibuildercompiler(opt, [callback])
Compiles a UI Builder schema so it can be rendered without the designer.
F.uibuildercompiler(opt, [callback])| Parameter | Type | Description |
|---|---|---|
opt.schema |
String|Object |
The UI Builder schema (JSON string or object). |
opt.origin? |
String |
The origin for relative component URLs. |
opt.download? |
Boolean |
Embeds the component HTML. Default: false |
opt.local? |
Boolean |
Skips resolving components. Default: false |
callback? |
Function(err, response) |
Receives the compiled schema. |
Returns Promise Only without a callback.
Finds the components used in the schema and resolves their render URLs from schema.components (relative URLs use opt.origin or schema.origin; a .json value is a list of more components). With opt.download the HTML of each component is downloaded and embedded as base64. With opt.local the components are not downloaded at all. The result is the schema without the editor data, with compiled: true and css taken from cssoutput. Without a callback it returns a Promise.
var app = await F.uibuildercompiler({ schema: body, download: true });
PATH.fs.writeFile(PATH.databases('app.json'), JSON.stringify(app), NOOP);