Render HTML from any SPA.
npm i tossr
const { tossr } = require('tossr')
const template = 'dist/index.html'
const script = 'dist/app.js'
const url = '/blog/ssr-is-fun'
const html = await tossr(template, script, url)Renders an HTML page from a HTML template, an app bundle and a path
templatestring Html template (or path to a HTML template).scriptstring Bundled JS app (or path to bundled bundle JS app).urlstring Path to render. Ie. /blog/breathing-oxygen-linked-to-staying-aliveoptionsPartial<Config>? Options
Type: object
hoststring hostname to use while rendering. Defaults to http://jsdom.ssreventNamestring event to wait for before rendering app. Defaults to 'app-loaded'beforeEvalEval Executed before script is evaluated.afterEvalEval Executed after script is evaluated.silentboolean Don't print timestampsinlineDynamicImportsboolean required for apps with dynamic importstimeoutnumber required for apps with dynamic importsdevboolean disables caching of inlinedDynamicImports bundleerrorHandlerfunction
Called before/after the app script is evaluated
Type: Function
domobject The DOM object *