HSVT templates

Text

Text that will appear in the user interface should be included in the HSVT file. For example, the pageTitle() and backLink() functions should be preferred to passing text in to the view from JavaScript.

Always prepare the text in your templates for internationalisation, except if you know it’ll never be needed because it’s a bespoke feature for a single client.

Whitespace

HSVT ignores whitespace, so use it to increase the clarity of your HTML structure. In particular, an angle bracket should always have whitespace around it.

<div>
  if(canEdit) {
    <p>
      <a href="..."> i("Edit") </a>
    </p>
  }
</div>

Layout

HSVT files should be indented 2 spaces and follow the same conventions as JavaScript for control flow.