diff --git a/sui/core/build.go b/sui/core/build.go index 6119b2251..d9b08aafe 100644 --- a/sui/core/build.go +++ b/sui/core/build.go @@ -284,6 +284,14 @@ func (page *Page) parseDynamics(ctx *BuildContext, sel *goquery.Selection) { return } ctx.addJitComponent(route) + + // This is a temprary solution, we will refactor this later + // Some components are not used in the page, but they are used in the script + // So we need to add them to the components + // But this solution is not perfect, it will cause import the unnecessary components, just ignore it. + // Add to the imports + name := fmt.Sprintf("comp_%s", strings.ReplaceAll(route, "/", "_")) + ctx.components[name] = route }) } diff --git a/sui/core/parser.go b/sui/core/parser.go index aa46f20f9..d7532834e 100644 --- a/sui/core/parser.go +++ b/sui/core/parser.go @@ -901,6 +901,7 @@ func (parser *TemplateParser) show(sel *goquery.Selection) { // sel.SetAttr("style", style) } +// Tidy the template by removing the parsed attributes func (parser *TemplateParser) Tidy(s *goquery.Selection) { s.Contents().Each(func(i int, child *goquery.Selection) {