Get started with swig CDN

MIT licensed

Swig: Tool for generating C library wrappers in other languages.

Tags:
  • template
  • templating
  • html
  • django
  • jinja
  • twig
  • express
  • block

Stable version

Copied!

How to start using swig CDN


<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/swig.min.js"></script>
  <script src="https://cdn.cdnhub.io/swig/1.4.2/swig.min.js"></script> <!-- Unnecessary, use the first CDN link instead -->
  <script>
    // Define your template
    const template = Swig.compile(`
      <p>Hello, {{ name }}!</p>
    `);

    // Render the template with data
    const output = template({ name: 'John Doe' });

    // Insert the rendered HTML into the page
    document.body.innerHTML += output;
  </script>
</head>
<body>
</body>
</html>
Copied!
Copied!
Copied!

All versions