Refactor SUI core to conditionally append page components in Compile function
This commit is contained in:
parent
276f29d777
commit
0dbdc0b99b
1 changed files with 4 additions and 2 deletions
|
|
@ -93,8 +93,10 @@ func (page *Page) Compile(ctx *BuildContext, option *BuildOption) (string, []str
|
||||||
}
|
}
|
||||||
|
|
||||||
// Page Components
|
// Page Components
|
||||||
rawComponents, _ := jsoniter.MarshalToString(ctx.components)
|
if ctx != nil && ctx.components != nil && len(ctx.components) > 0 {
|
||||||
body.AppendHtml("\n\n" + `<script name="imports" type="json">` + "\n" + rawComponents + "\n</script>\n\n")
|
rawComponents, _ := jsoniter.MarshalToString(ctx.components)
|
||||||
|
body.AppendHtml("\n\n" + `<script name="imports" type="json">` + "\n" + rawComponents + "\n</script>\n\n")
|
||||||
|
}
|
||||||
|
|
||||||
page.ReplaceDocument(doc)
|
page.ReplaceDocument(doc)
|
||||||
html, err := doc.Html()
|
html, err := doc.Html()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue