Bare simple static site generator ever.
See https://eguneys.github.io/ for example using Jener.
- Define a mix-in:
<!-- #mixin mymixin -->
<head>
</head>
- Define a layout and use the mixin:
<!-- #layout main -->
<html>
<!-- #include mymixin -->
<body>
<!-- #content article -->
</body>
</html>
- Define a page using the layout:
<!-- #page main article -->
<div>
Text
</div>
- Run
jener in-directory out-directory
and, it generates the output file for the page:
<html>
<head>
</head>
<body>
<div>
Text
</div>
</body>
</html>
It has only 2 features, mix-in and layout, to generate pages.
I asked this question on Stackoverflow which ended up deleted.
Instal jener
globally using yarn global jener
.
In a folder, put all your layout, mix-in and page definitions, in separate html
files.
Then run jener in-directory out-directory
. This will generate all your page definitions inside in-directory
into the out-directory
.
mix-in named mymixin
is defined with #mixin
command inside an html comment:
<!-- #mixin mymixin -->
mix-ins cannot include other mix-ins.
layout named main
is defined the same:
<!-- #layout main -->
mix-in's are included with a #include command:
<!-- #include head -->
A layout defines area (named article
) to replace with content with #content
command:
<!-- #content article -->
A page is defined with a #page
command. Pages might not have a layout and can use mix-ins:
<!-- #page -->
Pages don't have a name. All pages are exported with the same name as their definition file.
A page with a main
layout, is defined as:
<!-- #page main -->
page with a layout must specify which area to replace from the layout.
<!-- #page main -->
<!-- #content article -->
That, replaces #article
area.
There is a shorthand for above two commands:
<!-- #page main article -->
A layout can define multiple area's to be replaced and page can specify multiple areas to replace from the layout.
All page definitions export into a separate html file. Output filename is the same as the filename of the page definition.
Install dependencies: yarn install
.
Run the tests: yarn test
.
Run the examples: yarn example
.
Questions about parsing:
- https://stackoverflow.com/questions/63876748/how-to-parse-a-string-of-commands-that-appear-multiple-times-into-an-array
- https://stackoverflow.com/questions/63880636/how-to-get-matched-index-of-a-regex-for-all-occurences
Happy blogging 💙