Type Alias ExternalFormatter

Source
pub type ExternalFormatter = dyn Fn(MediaType, String, &Configuration) -> Result<Option<String>>;
Expand description

A callback that will be called when encountering certain tagged templates.

Currently supports css, html and sql tagged templated.

Examples:

const styles = css`color: red;`;

const markup = html`<html>
  <body>
    <h1>Hello!<h1>
  </body>
</html>`;

const query = sql`
SELECT
  *
FROM
  users
WHERE
  active IS TRUE;

External formatter should return None if it doesn’t understand given MediaType, in such cases the templates will be left as they are.

Only templates with no interpolation are supported.