dna-poster

DNA

Progressive Web Components.

Use in Node.js

DNA is a component library based on Document Object Model. In order to work in Node.js it uses the jsdom library to create a DOM environment.

$ npm i @chialab/dna jsdom

Sample:

// get the module namespace
const { Component, customElements, DOM, html, render } = require('@chialab/dna');

class HelloWorld extends Component {
    render() {
        return html`<h1>Hello world!</h1>`;
    }
}

customElements.define('hello-world', HelloWorld);

const card = render(new HelloWorld());

console.log(card.outerHTML);
// -> "<hello-world><h1>Hello world!</h1></hello-world>"