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
Press Ctrl+C to stop.

The folder is served over HTTP as it is. Open the 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 {{param}} macros are filled in by our script on your client’s website and by the mail pipeline when a mail is sent, so in the local preview they stay as they are. To see the template with the default values from the manifest, open it with the query parameters 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.