@formfeed/devkit
The local half of the Formfeed development kit: template folders, project
configuration (formfeed.json) and offline rendering with the same engine the API uses. The
formfeed CLI and
@formfeed/testing are built on it; use it
directly when you write your own tooling around a template repository.
npm install @formfeed/devkit
import { defaultData, diagnose, projectAround, readTemplate, renderLocal } from '@formfeed/devkit';
const project = projectAround('templates/invoice-de');
const tpl = readTemplate(project, 'invoice-de');
const { data } = defaultData(tpl);
console.log(diagnose(tpl, data));
const { document } = await renderLocal(project, tpl, data, { mode: 'print' });
Errors are DevkitError instances with a code, which the CLI maps to its exit codes.
Documentation
Licence
MIT