Skip to main content

Spawns

Evolve will only compile templates into a build which are reachable from the main entry point of an application.

This is generally very desirable because it means we don't include things that are not used which saves on both compile time and code size. Occasionally you'll want to spawn something like a 'window' where the content of that window isn't directly reachable by traversing all of the templates/typography usages from the entry point.

In cases like this, there is a way to force a template to be included in a build even if it is not directly referenced. This element is then traversed just like the entry point to find all of the templates that should be included in a build.

To do this, you can declare a spawns member in any top level declaration. The syntax accepts a list of qualified names of templates. These names are resolved using the usual import resolution rules, so you may or may not need to include the specific module names depending on your application.

template WindowSpawner {

spawns [SomeModule::TemplateName, AnotherTemplate];

render { ... }

}