@static-pages/twig-writer
v5.0.0
Published
Twig template engine for Static Pages.
Downloads
16
Readme
Static Pages / Twig File Writer
Renders page data via twig templates into files.
Merges the @static-pages/file-writer and @static-pages/twig-renderer packages together for convenience.
This package is part of the StaticPagesJs project, see:
- Documentation: staticpagesjs.github.io
- Core: @static-pages/core
Usage
import twigWriter from '@static-pages/twig-writer';
const writer = twigWriter({
outDir: 'dist',
outFile: d => d.urlPrefix + d.url,
viewsDir: 'myViews',
view: 'content.twig',
});
const pageData = { title: 'Page header', body: 'My Content' };
writer({ value: pageData }); // writes the rendered page to the disk as a file.
Options
The available options are an union of the file-writer
options and the twig-renderer
options.