31 lines
1.1 KiB
Markdown
Raw Normal View History

2020-11-21 15:08:16 +01:00
# Test static site generation
## Introduction
This small snippet aims to convince that you can render all static pages at once using SSG-scheme.
## OK, what should I see?
Scheme is as follows:
- Aim is to deliver plain ol' HTML pages by web server. No, no application server accepted; This is best for most of services!
- Problem: You have redundant content, and you don't want the hassle to maintain HTML files:
- No functions, so redundant code;
- Can't properly handle modular breakdown (header, footer, sections);
- When you made it work once, shall you re-understand everything 6 months later to thange stubs?
Here is how it works:
- We store relevant data in a YAML file, say `settings.yml`.
- We Use [Nunjucks](https://mozilla.github.io/nunjucks/templating.html), the millenials way to code, to generate Jinja2-styled webpages on steroids.
- We Then compile the whole _once_, and after we got static HTML for basically every use.
What repo doesn't contain:
- All Nunjucks killer features.
## Dependencies
Install NodeJS and npm
## Build
```bash
npm run build
```
Serve your webserver to display the `public` folder as webroot.