thetillhoff / temingo

Minimal golang templater for websites.
MIT License
1 stars 0 forks source link

temingo

This software aims to provide a simple but powerful templating mechanism.

The original idea was to create a simple static site generator, which is not as overloaded with "unnecessary functionality" as f.e. hugo. The result, though, should not specifically be bound to website contents, as it can be used for any textfile-templating. -> At least when #9 is resolved.

Temingo supports

Installation

If you're feeling fancy:

curl -s https://raw.githubusercontent.com/thetillhoff/temingo/main/install.sh | sh

or manually from https://github.com/thetillhoff/temingo/releases/latest.

Features

Templating engine

Temingo will by default:

Ignoring source files

Consider the ignored paths as described in ./.temingoignore which has a similar syntax as a .gitignore.

Support for static files / assets

Take all other files (static) and copy them into the output folder as-is. Except meta.yamls.

Partial templates

Take all *.partial* files as intermediate templates / snippets

Component template

Dynamic metadata

Metadata hierarchy

Metadata that is passed to the rendering will be aggregated as follows;

Metadata child list

For each *.template* file, temingo searches for all ./*/meta.yamls and adds them as .childMeta.<foldername>.<content-object> pair to the template. This means you can iterate over them and for example generate links for them.

optional TODO have a path that can be set in the template, for which the files can be read

Metatemplates

Take all *.metatemplate* files and use them as template in all of the sibling subfolders that contain a meta.yaml file. The object in those files are passed for each rendering.

Content markdown

Supports configuration file

Read configuration from a ~/.temingo.yaml file and a ./.temingo.yaml file.

verify config file support

Watch-mode

Integrated simple webserver

Optimizations

Beautify

TBD

This is currently enabled by default.

Minify

TBD

Media & Media references

TBD

Usage

temingo
temingo init // Generates a sample project in the current folder. Only starts writing files if the input directory doesn't exist yet. Supports all flags except `--watch`.
<!-- --valuesfile, -f, default []string{"values.yaml"}:Sets the path(s) to the values-file(s). // TODO adjust docs as its already implemented via meta.yaml -->
--inputDir, -i, default "./src": Sets the path to the template-file-directory.
--outputDir, -o, default "./output": Sets the destination-path for the compiled templates.
--templateExtension, -t, default ".template": Sets the extension of the template files.
--metaTemplateExtension, -m, default ".metatemplate": Sets the extension of the metatemplate files. Automatically excluded from normally loaded templates.
--partialExtension, -c, default ".partial": Sets the extension of the partial files.
--metaFilename, default "meta.yaml": Sets the filename of the meta files.
--temingoignore, default ".temingoignore": Sets the path to the ignore file.
--watch, -w, default false: Watches the inputDir and the temingoignore.
--dry-run, default false: If enabled, will not touch the outputDir.
--verbose, -v, default false: Enables the debug mode which prints more logs.

temingo will by default:

TODO

Development

Adding commands / subcommands

cobra-cli add <command>

How to test

go test ./...

Decisions / best practices