Skip to content
SiteEmail

Configuration

Every option is optional.

rasterize({
playerPath: process.env.GAMEFACE_PATH,
routes: ['index.html'],
bakeScale: 2,
transcode: false,
textureBudgetMB: 32,
strictTransitions: false,
ssimThreshold: 0.995,
verify: false,
audit: true,
diffThreshold: 0.005,
overlay: undefined,
overlayKey: 'F9',
runtime: 'auto',
advisor: true,
outDir: 'rz/',
cacheDir: 'node_modules/.cache/rasterize',
port: 9444,
viewport: { width: 1920, height: 1080 },
maxViewport: { width: 4096, height: 4096 },
headed: false,
debug: false,
});
OptionTypeDefaultDescription
playerPathstring$GAMEFACE_PATHThe Gameface Player executable.
routes(string | RasterizeRoute)[]['index.html']Pages to visit during capture.
bakeScalenumber2Supersampling factor.
transcode'webp' | falsefalseEmit a WebP companion beside each PNG. Saves disk, not VRAM.
textureBudgetMBnumber32VRAM budget; exceeding it warns with the worst offenders.
strictTransitionsbooleanfalsePromote RZ002 from warning to error.
ssimThresholdnumber0.995SSIM floor for verification.
verifybooleanfalseVerify after baking and fail the build on a real difference.
auditbooleantrueRender the finished build against itself-without-the-bake and write the comparison.
diffThresholdnumber0.005Share of differing pixels above which the audit warns.
overlayboolean(hidden)Dev overlay: true draws it at once, false disables it, default hides it behind the toggle key.
overlayKeystring'F9'Key that shows and hides the dev overlay.
runtime'auto' | 'observe' | 'off''auto'Whether a script is emitted for element-mode subtrees the build could not flatten.
advisorbooleantrueReport unmarked elements using expensive properties.
outDirstring'rz/'Asset directory inside the build output.
cacheDirstring'node_modules/.cache/rasterize'Where bakes are cached.
portnumber9444Starting debug port; the first free one at or after it is used.
viewport{width, height}1920x1080Bake viewport, grown automatically to fit the largest asset.
maxViewport{width, height}4096x4096Ceiling for that automatic growth.
headedbooleanfalseShow the Player window while baking.
debugbooleanfalseDump every capture and its geometry into the cache directory.

A route is a page to load plus optional JavaScript to run before capture. Use it to reach anything that is not on screen when the page finishes loading, and to stop your update loop — which is the single largest source of un-baked elements.

routes: [
'index.html',
{
path: 'index.html',
preload: 'Math.random = () => 0.5;',
setup: "document.querySelector('#settings').click(); await new Promise(r => setTimeout(r, 200));",
settleMs: 400,
},
];
FieldMeaning
pathPage to load, relative to the build output. May include a hash route.
preloadJavaScript injected before the page’s own scripts run. For anything decided at module init, such as a random seed.
setupJavaScript run after the page has loaded. For opening menus and stopping loops. May return a promise.
settleMsExtra wait after setup resolves.

Anything that never renders during capture is never baked.

Bakes are captured at twice the authored size by default, which covers a 1080p-authored design up to 4K. Individual elements can override it with data-rasterize-scale.

Scale multiplies into texture memory: doubling it quadruples the VRAM.

audit is on by default and costs two extra page loads per route. It renders the finished build against itself-without-the-bake and writes both plus their difference to rz/report/. It is the only check that sees the page as a whole, and it is what catches a texture that landed in the wrong place or never matched anything.

verify is a stricter per-asset SSIM check intended for CI. It currently cannot check decoration assets and refuses to run when any are present — see things to watch out for.

A decoration is drawn by a ::before, so nothing is added to your markup and no script is needed, including for state variants. Most builds ship no JavaScript and get no <script> tag.

Element mode is the exception, because flattening removes nodes and CSS cannot.

ValueBehaviour
'auto'Default. Emits a script only for element-mode subtrees no HTML file contained, flattens them at DOMContentLoaded, then stops. Reported as RZ026.
'observe'Also watches for element-mode subtrees mounted after load.
'off'Never emits a script. Anything unreached keeps its original DOM.

The capture window is a hard ceiling on how large one asset can be, and grows automatically to fit the largest planned bake up to maxViewport. If your layout is sized in vh, pin the root font size in setup so the window cannot inflate your whole UI — see preparing your UI.

In dev the plugin injects an overlay that classifies every marked element the way the build would, without launching the Player. Press F9. It costs nothing until you press it.