mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
29 lines
585 B
HTML
29 lines
585 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>liquidjs for the browser</title>
|
|
<script src="node_modules/liquidjs/dist/liquid.min.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<script>
|
|
var Liquid = window.liquidjs.Liquid
|
|
var engine = new Liquid({
|
|
extname: '.html',
|
|
cache: true
|
|
});
|
|
var src = "<h2>Welcome to {{ name | capitalize}}, {% include 'date.html' %}</h2>";
|
|
var ctx = {
|
|
name: 'Liquid',
|
|
date: new Date()
|
|
};
|
|
engine.parseAndRender(src, ctx)
|
|
.then(function(html) {
|
|
document.body.innerHTML = html
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|