GX5003: class string is built at runtime
A class value is made when the program runs: fmt.Sprintf, fmt.Sprint, strings.Join or a + with a value that is not a constant.
Cause
A class value is made when the program runs: fmt.Sprintf, fmt.Sprint, strings.Join or a + with a value that is not a constant. Tailwind reads the source files, so it cannot see a class that is made later.
Example
package card
props {
Size string
}
<article class={"p-" + p.Size}>Text</article>gx check reports:
ui/card/Card.gx:7:17: GX5003: class string is built at runtime; Tailwind cannot see itFix
- Write each class as a full static string.
- Use a
gx.Enummap to select one of a set of static strings.