Get started with tmlib.js CDN
Stable version
Copied!
How to start using tmlib.js CDN
// Import tmlib.min.js from the CDN
const TMLib = require('tmlib/dist/tmlib.min.js');
// Define the template using TMLib's template literals
const template = `
<div>
<h1>Hello, ${name}!</h1>
<p>Your age is ${age}.</p>
</div>
`;
// Compile the template using TMLib
const compiledTemplate = TMLib.compile(template);
// Data to be rendered in the template
const data = { name: 'John Doe', age: 30 };
// Render the template with the data
const output = compiledTemplate(data);
// Log the rendered output to the console
console.log(output);
Copied!
Copied!