Skip to content

andi1984/back2roots

develop
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
md
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Twig + Markdown HTML Generator

GitHub GitHub tag (latest by date) Node CI Coverage Status GitHub language count GitHub code size in bytes

Run npm run start to generate the HTML files based on the Markdown files saved inside the md folder.

The HTML content of the markdown files is going to be passed as content variable to the twig template specified in the respective template frontmatter of the markdown file. If none is specified, the templates/main.twig file is used as a fallback.

The output files are saved to the dist directory.

NPM scripts

Name Description
test Self-exploratory: Run your test suite here.
tsc Runs the typescript compiler and checks for errors
dev Starts a static file server and watches for content (e.g. template) or typescript files.
watch-content Watches for content (template) changes
watch Watches for changes on the core typescript files for the static page generator itself.
build Builds the output static HTML files.
assets Task for you to generate your assets with.
start Build HTML files using build task and builds assets with assets task.
release Command to generate a new release version.

Twig Template Variables

Variable Description Example
title Title of the page "Foo" (default: The filename)
sites Array of all build sites cf. Site interface
content Content of the page as HTML cf. "<h1>Hello World</h1>"
url The URL of the current page. e.g. www.my-base-url.com/hello-world.html
base_url The base url of the page cf. URL in env vars below
meta All metadata provided via frontmatter for given site cf. {title: 'foo', template: 'bar', author: 'Max Mustermann'

CLI Options

Option Alias Description Default
--clean --c Flag to indicate whether distribution folder should be cleaned before every build. false

Environment Variables

Variable Description Example
URL URL of your page URL: https://www.google.de
PRETTY indicate whether hosting can handle pretty URLs (e.g. /hello/world instead of /hello/world/index.html) PRETTY: true

Configuration

You can configure certain parts of the system. All config files are contained within the config folder.

Hooks

method Description Example
sitesSorting Sorts the sites before any further action (e.g. generating the HTML files) Sort by date metadata/frontmatter field.