Get started with art-template CDN

MIT licensed

Art-template is a popular and efficient JS template engine for rendering HTML.

Tags:
  • template

Stable version

Copied!

How to start using art-template CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with art-template CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/art-template/4.13.2/index.js"></script>
</head>
<body>
    <div id="app"></div>
    <script>
        const template = `
            <ul>
                {{each data as item}}
                    <li>{{item.name}} - {{item.age}}</li>
                {{/each}}
            </ul>
        `;

        const data = [
            { name: 'Alice', age: 25 },
            { name: 'Bob', age: 30 },
            { name: 'Charlie', age: 35 }
        ];

        const compiled = ArtTemplate.compile(template);
        const output = document.getElementById('app');
        const rendered = compiled(data);

        output.innerHTML = rendered;
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions