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
meta.yaml
files),.temingoignore
) that works similar to .gitignore
, but for the templating process..temingoignore
- and trigger a rebuild if necessary.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.
Temingo will by default:
*.template*
files from the source folder ./src
../output
.Consider the ignored paths as described in ./.temingoignore
which has a similar syntax as a .gitignore
.
Take all other files (static) and copy them into the output folder as-is. Except meta.yaml
s.
Take all *.partial*
files as intermediate templates / snippets
partial/page.partial.html
is the automatic default name for that partial.{{define ...}} ... {{ end }}
part to partials, it's added automatically.{{ template "*.partial.css" . }}
, also for subfolders./src/components/*
, and create a map[string]interface{} aka map[filename-without-extension]interface{} // TODO is it the right type?key=value
.{{ icon/github }}
those files are taken instead..meta.path
of the rendered template.meta.breadcrumbs
contains a slice of the folder hierarchy for each templateMetadata that is passed to the rendering will be aggregated as follows;
./src
down to the folder containing the template filemeta.yaml
(if it exists) into the parent one (overwrite if necessary)For each *.template*
file, temingo searches for all ./*/meta.yaml
s 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
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.md
it is converted to html and made available as .content
during the templating.Read configuration from a ~/.temingo.yaml
file and a ./.temingo.yaml
file.
verify config file support
file extension autodiscover
temingo can do (this should be put into a dedicated application ("website optimizer"?) which could also include submodules like minifyCss, minifyHtml, minifyJs, prettifyCss, prettityHtml, prettifyJs):
.html
.css
.js
.html
.css
.js
[ ] SHA256, SHA384, and SHA512 generation for files, for example *.js
files, so they can be added to your csp config file
TBD
This is currently enabled by default.
TBD
is it good to do this here? Wouldn't it be better to use something else instead? Linux approach, do one thing, but do it good.
[ ] add flag / setting
[ ] minify html, warn user if there are undefined css classes used
[ ] minify css, warn user if there are unused css classes
[ ] minify js
TBD
is it good to do this here? Wouldn't it be better to use something else instead? Linux approach, do one thing, but do it good.
[ ] add flag / setting
[ ] file extension autodiscover (html files only, which image format is used, depending on setting media format can be transformed as well)
[ ] optimize media embedding automatically, but warn the user
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:
["path"] = string -> path to template (within `./src/`)
["breadcrumbs"] = []string -> path to location of template, split by '/'
["meta"] = map[string]object -> aggregated metadata for current folder
["childMeta"] = map[string]object -> metadata of subfolders, key is the folder name containing the respective metadata
* (for example the `meta.yaml` object -> it'll start at the root folder, then start descending the folder-tree and grab all `meta.yaml`s along the way. Merged in a way that overwrites the parents' values.)
Test the rendering via golang tests, not manually.
move funcmap add to template engine into extra function, so it happens always exactly the same for the temporaryTemplateEngine and the templateEngine
automatically check all "internal" links of website for validity aka file exists
allow blacklisting urls/paths, including wildcards
add check to scan for response codes from websites that are called, also with blacklist of domains where links are not checked
automatically check all links that have a protocol specified to use https
cobra-cli add <command>
go test ./...