ZPT-JS tutorial - Using ZPT-JS and node.js

Using ZPT-JS and node.js

That's OK. But... how can we use ZPT-JS at the server side (using node.js)? jsdom is needed when no browser is available:

var jsdom = require( 'jsdom' );
var { JSDOM } = jsdom;

// Build JSDOM instance
var dom = new JSDOM(
    '<!doctype html>'
	+ '<html>'
	+ '<body><h1 data-content="'hello, world!'">a text</h1></body>'
	+ '</html>'
);

// Init some important vars
var window = dom.window;
var document = window.document;
global.window = window;

// Parse template
import { zpt } from './zpt-esm.js';
zpt.run({
    root: document.body,
    dictionary: {}
});

console.log( 'Done!' );