HTML template engine build

Constants#

  • HTML
  • Pug

The values set in Site Setting and Build Settings can be used in the template engine.

constantsdescriptionnode-config key
IS_PRODUCTIONWhether the build mode is NODE_ENV=production or not-
SITE_TITLESite titletitle
SITE_URLSite URLurl
SITE_AUTHORSite authorauthor
SITE_DESCRIPTIONSite descriptiondescription
SITE_ROOTSite root path (e.g. /)siteRoot
CSS_DIRCSS directory path (e.g. /common/css)deployDir.css
IMG_DIRImage directory path (e.g. /common/img)deployDir.img
JS_DIRJavaScript directory path (e.g. /common/js)deployDir.js
JSON_DIRJSON 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#

  • Pug

Transform the YAML file placed in Pug's workspace in JSON format.
e.g. - var foo = readYAML('assets/data/foo.yml')

PHP filter#

  • Pug

<?php ... ?> can be inserted.

div
:php
echo '1';

Result below.

<div><?php echo '1'; ?></div>