Preview and validation
On this pageShowHide

Preview and validation

Every template command takes the template folder as an argument and defaults to the current folder, so inside the template you can leave it out.

Preview in the browser

Shell
trustisto template start ./my-popup
Text
Serving ./my-popup on http://localhost:8080/index.html?id=test&locale=en&test=1
Press Ctrl+C to stop.

Open the printed address in the browser and reload the page after a change. --port picks another port. If the template would not pass validation yet, start still serves it and lists the problems as a warning.

The page shows up filled in: our script, which every template loads (a mail too; it is removed when the mail is sent), replaces the {{param}} macros with the defaults from the manifest in the language of --locale (en unless set):

Shell
trustisto template start ./my-mail --locale pl

A parameter added to the address overrides its default, for example &headerTitle=Hello. The query parameters are described in Testing.

Validate

Shell
trustisto template validate ./my-popup

template validate runs the same checks as the upload in the panel, so you find problems before deploying:

  • manifest.json exists, is valid JSON and matches the manifest schema,
  • the files the type needs are there: index.html for every type, plus manifest.json and thumbnail.png for a popup or a topbar,
  • index.html of a popup or a topbar loads the Trustisto template script,
  • index.html of a mail has the {{unsubscribeUrl}} and {{seeInBrowserUrl}} macros (see Mail templates),
  • the package has at most 100 files and 10 MB.

Each problem is printed on its own line, starting with the file it is in:

Text
manifest.json: params.footer.type must be equal to one of the allowed values
index.html: no {{unsubscribeUrl}} macro, the upload will reject it

The command exits with code 1 when something is wrong, so it can stop a CI pipeline. Deploying runs the same checks first and does not upload an invalid template.