Skip to content

Conversation

Russman12
Copy link

@Russman12 Russman12 commented Sep 17, 2025

This is a working example of a complex custom templating functionality. To run this, run the following commands cd examples/custom-templates, npm install, npx ts-node exec.ts.

The following files are key to the functionality:

  • src/engine.ts: this is the singleton instance which hold all static details such as directory configs, cached templates, the complete view data, etc.
  • src/renderer.ts: this contains logic for how files are rendered and calls resources from the engine.
  • src/bundles/bundle.ts: abstract class which contains functionality common to all bundles, eg all bundles must contain some array of bundles, and have a "renderAll" function.
  • src/bundles/default/default.ts: this class is a bundle definition. It contains all renderers and helper functions for the templates it produces. There should be a subdirectory which contains the templates for the bundle as well, but I ran into a speed bump making that work in conjunction with a configured directory.

#286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant