Add a static option to res.render()
If a page has no need for interaction, make it possible to flag it as a static page in res.render() like this:
res.render('ui/pages/index/index.js', {
layout: 'ui/layouts/app/index.js',
static: true
});
The idea being that you can just omit scripts during SSR and only return the compiled HTML/CSS. Would be good for any page that doesn't have any DOM events/state/interaction.
Closing #283 in favor of this.
The note above isn't 100% correct. This should create a built, cached copy of the page at a path like /static in the app. At deployment time, the build would generate these pages as static HTML, CSS, and JavaScript. Then, the res.render() function could check that path relative to the page it was passed. If a file exists, it defaults to that (barring some expiration logic), if not, it generates it and returns the initial build.
An alternative option for this is to add a separate method called res.static(). Same idea as above, but it'd be an independent method that could have its own options/perf tuning.