0.10.0 • Published 12 months ago

@andi1984/back2roots v0.10.0

Weekly downloads
7
License
MIT
Repository
-
Last release
12 months ago

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

NameDescription
testSelf-exploratory: Run your test suite here.
tscRuns the typescript compiler and checks for errors
devStarts a static file server and watches for content (e.g. template) or typescript files.
watch-contentWatches for content (template) changes
watchWatches for changes on the core typescript files for the static page generator itself.
buildBuilds the output static HTML files.
assetsTask for you to generate your assets with.
startBuild HTML files using build task and builds assets with assets task.
releaseCommand to generate a new release version.

Twig Template Variables

VariableDescriptionExample
titleTitle of the page"Foo" (default: The filename)
sitesArray of all build sitescf. Site interface
contentContent of the page as HTMLcf. "<h1>Hello World</h1>"
urlThe URL of the current page.e.g. www.my-base-url.com/hello-world.html
base_urlThe base url of the pagecf. URL in env vars below
metaAll metadata provided via frontmatter for given sitecf. {title: 'foo', template: 'bar', author: 'Max Mustermann'

CLI Options

OptionAliasDescriptionDefault
--clean--cFlag to indicate whether distribution folder should be cleaned before every build.false

Environment Variables

VariableDescriptionExample
URLURL of your pageURL: https://www.google.de
PRETTYindicate 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

methodDescriptionExample
sitesSortingSorts the sites before any further action (e.g. generating the HTML files)Sort by date metadata/frontmatter field.