mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 12:20:40 -07:00
refactor: import babelify
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
const Liquid = require('../..')
|
||||
|
||||
let engine = new Liquid()
|
||||
let src = 'Welcome to {{ name | capitalize}}, access time: {{date|date: "%H:%M:%S"}}'
|
||||
let engine = new Liquid({
|
||||
root: __dirname,
|
||||
extname: '.liquid'
|
||||
})
|
||||
let ctx = {
|
||||
name: 'Liquid',
|
||||
date: new Date()
|
||||
todos: ['fork and clone', 'make it better', 'make a pull request'],
|
||||
title: 'Welcome to liquidjs!'
|
||||
}
|
||||
|
||||
engine.parseAndRender(src, ctx).then(console.log)
|
||||
engine.renderFile('todolist', ctx).then(console.log)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
{% for todo in todos %}
|
||||
<li>{{forloop.index}} - {{todo}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
Reference in New Issue
Block a user