Compile-time website checking
I want a static site generator that enforces a bunch of rules at compile-time so whole classes of errors cannot occur. Similar to my ideas from last year.
Compile-time checks
- All templates define their input data structures (e.g. as JSON schema)
- Optional fields can only be accessed in an if clause or with explicit defaults, else the compilation will panic (like (implicitly?) calling Rust’s
Option::unwrap
). - This includes minimum image dimensions
- Optional fields can only be accessed in an if clause or with explicit defaults, else the compilation will panic (like (implicitly?) calling Rust’s
- In the same way, content files are validated against content schemas (e.g. JSON schema) as well as the template schemas where they are used.
- HTML output will be checked with
- a HTML5 validator
- a simple SEO-sanity validation
- Sane outline
- Metatags
- a validator for Microformats
Whole-page optimisations after the compilation:
- Remove all unused CSS
- Check that all links work
Other notes
- Build a dependency tree
- with page templates at root and used partials/required assets as leaves
- with content pages and content includes
- Pre-compile template variants (code generation)
- Keep as much information as possible to give good errors
- Support auto-reload for templates and assets
- At first it could be fast enough to always recompile
- Using code generation and dependency tree: Cache leaves, invalidate up the the tree
- Add simple router facility to generate map of pages
- Ideally, write as stand-alone application
- node.js currently has best ecosystem, but is hard/impossible to bundle as binary when using native dependencies (which we of course will)
- Optimisations may depend on stuff like PhantomJS
- Of course:
- Automatically build editor UIs from content schemas
- Automatically generate style guides form template filled with random data