No description
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| LICENSE | ||
| README.md | ||
treessg
A modular static site generator. I plan to write this so that modules can be dynamically loaded at runtime and executed in a pipeline style, i.e. similar to ordered middleware.
Example run:
- Config has 'blog', 'core', 'nav', 'html' modules mentioned
- Scan /modules for core/mod.ts blog/mod.ts and nav/mod.ts
- runPipeline will step through each module and add/modify the site data object
- 'blog' will create tree entries for blog posts found in data/blog/; it will mark data/blog/ as 'touched by blog'
- 'core' will look through data/ and read any non-excluded path. 'core' would typically be configured to ignore 'touched by blog' paths
- 'nav' will take this context and create a navigation menu
- 'html' will take this context and create .html pages in output/ (or whatever is configured)
- Of course, order matters here. If 'core' were run first, then it would absorb data/blog/ and 'blog' would also absorb it; however 'nav' would typically come last, or at least after every tree-modifying module has been called.
- Now that the site data (context) has been instantiated, we can render...
- We will loop through the pages in the context, for each page calling renderPage
- renderPage takes all the available modules, and each module with a enrichData callback will have it called on the context
- This way, modules (1) create context, (2) act on the context on a per-page basis
- (2) is useful for, e.g. a on the page which should highlight the current page but link to all the rest
Future ideas:
- Namespace module data, e.g 'html' will write to module_data['html'], and 'html-minify' will act on module_data['html']
- A branch module for fan-out which will clone the previous context and give it to other modules; the last module in the branch passes on the context