Link Search Menu Expand Document

No module build

To support older browsers without JS module support or to realize a small web application without requiring JavaScript modules, the nomodules variant can be used.

Import statement

<script src="pathToNodeFolderOfApp/node_modules/@hofjs/hofjs/lib/nomodule/hof.js"></script>

Usage sample

Minimal nomodules example

<!DOCTYPE html>
<html>
<head>
    <title>Counter app</title>
    <script src="../lib/nomodule/hof.js"></script>
    <script>    
        // Inline JS - should be outsourced to external file.      
        customElements.define("main-app", class extends HofHtmlElement {
            templates = html`<h1>Hello at ${new Date()}</h1>`
        });
    </script>
</head>
<body>
    <main-app></main-app>
</body>
</html>

Hof.js is an open source project of Hof University of Applied Sciences. It is MIT licensed.