mirror of
				https://github.com/fooflington/selfdefined.git
				synced 2025-10-30 21:58:32 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			651 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			651 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html>
 | |
| 
 | |
| <head>
 | |
|   <title>liquidjs for the browser</title>
 | |
|   <script src="../../dist/liquid.js"></script>
 | |
| </head>
 | |
| 
 | |
| <body>
 | |
|   <script>
 | |
|     var engine = window.Liquid({
 | |
|       extname: '.html',
 | |
|       cache: true
 | |
|     });
 | |
|     var src = '<h2>Welcome to {{ name | capitalize}}, ' +
 | |
|       'access time: {{date|date: "%Y-%m-%d %H:%M:%S"}}</h2>';
 | |
|     var ctx = {
 | |
|       name: 'Liquid',
 | |
|       date: new Date()
 | |
|     };
 | |
|     engine.parseAndRender(src, ctx)
 | |
|       .then(function(html) {
 | |
|         return engine.renderFile('hello', ctx);
 | |
|       })
 | |
|       .then(function(html) {
 | |
|         document.body.innerHTML += html
 | |
|       });
 | |
|   </script>
 | |
| </body>
 | |
| 
 | |
| </html>
 | 
