HTML template engine build
Constants#
The values set in Site Setting and Build Settings can be used in the template engine.
| constants | description | node-config key |
|---|---|---|
IS_PRODUCTION | Whether the build mode is NODE_ENV=production or not | - |
SITE_TITLE | Site title | title |
SITE_URL | Site URL | url |
SITE_AUTHOR | Site author | author |
SITE_DESCRIPTION | Site description | description |
SITE_ROOT | Site root path (e.g. /) | siteRoot |
CSS_DIR | CSS directory path (e.g. /common/css) | deployDir.css |
IMG_DIR | Image directory path (e.g. /common/img) | deployDir.img |
JS_DIR | JavaScript directory path (e.g. /common/js) | deployDir.js |
JSON_DIR | JSON directory path (e.g. /common/data) | deployDir.json |
Functions extended#
A function that is not the default function provided by the template engine, but is a proprietary extension.
readYAML(path: string): object#
Transform the YAML file placed in Pug's workspace in JSON format.
e.g. - var foo = readYAML('assets/data/foo.yml')
PHP filter#
<?php ... ?> can be inserted.
Result below.