GX6010: construct that an email cannot hold
A component of an email package has a class, a signal, a client expression, an action invocation, an island or a script.
Cause
A component of a package with the name email is a part of an email. An email client runs no script, and it does not read the stylesheet of the site. These constructs do nothing in an email:
- A
classattribute or aclass:directive. - A signal.
- A client expression, for example
show={$Open}. - An action invocation, for example
on:click={route.Add{}}. - An island.
- A
scriptelement.
gx.RenderEmail returns an error for the same constructs in a component of a different package.
Example
package email
props {
// Text is the text of the notice.
Text string
}
<p class="text-sm">{p.Text}</p>gx check reports:
email/Notice.gx:8:4: GX6010: a component of an email package has a class attribute on <p>; an email client runs no script and reads no stylesheet of the siteFix
- Write the look in a
styleattribute:style="font-size:14px;color:var(--foreground)".gx.RenderEmailgives eachvar()the value of its theme token. - Give a value as a prop, not as a signal.
- For an action, use a link to a page of the site.
gx.RenderEmailmakes the link an absolute URL.