Renderers

Renderers handle each files in rootDir (and its subdirectories) and emit output into outDir.

my-static is equipped with built-in renderers for jade (.jade), ejs (.ejs) and dustjs (.dust).

It also has a renderer for Sass (.sass, .scss) that compiles Sass code into CSS. Note that you need to manually install node-sass to the project directory in order to use this feature.

Renderers for some static files (.css, .js, .html) are also available. These renderers just copy files into output directory.

my-static determines which renderer to use by the target's extension.

Some built-in renderers have special features.

dustjs

Since dustjs is filesystem-independent by design, references to other templates are implemented by the renderer. Template names are treated as relative paths from referrers.

When loading other templates, you can use special variables $PROJ and $ROOT. These variables are replaced with the absolute path to the project directory (directory where myst.json is located) and the root directory (rootDir), respectively. Using these variables, you can load templates by the same notation from anywhere.

By the dustjs renderer, dustjs' config is set as following.

dust.config.whitespace = true;
dust.config.cache = false;

If you want to add your helpers or do other customize, use extensions as follows:

extensions/dust.js
module.exports = (context)=>{
  const dr = context.getRenderer('dummy.dust');
  const dust = dr.dust;

  dust.helpers.myHelper = ...;
};