@static-pages/twig-writer
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

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:

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.

/@static-pages/twig-writer/

    Package Sidebar

    Install

    npm i @static-pages/twig-writer

    Weekly Downloads

    206

    Version

    5.0.0

    License

    MPL-2.0

    Unpacked Size

    22.9 kB

    Total Files

    8

    Last publish

    Collaborators

    • laszlo87
    • lionel87