node-simple-html-template
HTML file templating to mange common file dependency while creating simple static webpages
installation:
yarn add kapid_html
npm i kapid_html
Configuration details and usage
Following is the static value of configuration used in the plugin:
- PAGE_ROOT = "src/templates/pages/";
- TEMPLATE_ROOT = "src/templates/";
- OUTPUT = "public";
configuration in package.json script:
"scripts": {
"build-html": "node ./node_modules/kapid_html",
}
How it works
Sample src/templates/pages/home.html file:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Home</title>
</head>
<body>
<div>Main content</div>
{{include_html "common/footer.html"}}
</body>
</html>
Sample src/templates/common/footer.html file:
<footer>
<h5>Footer HTML</h5>
<div>Main footer contnet</div>
</footer>
After kapid_html build:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Home</title>
</head>
<body>
<div>Main content</div>
<footer>
<h5>Footer HTML</h5>
<div>Main footer contnet</div>
</footer>
</body>
</html>