diff --git a/demo/nodejs/footer.liquid b/demo/nodejs/footer.liquid new file mode 100644 index 000000000..1ebe82b66 --- /dev/null +++ b/demo/nodejs/footer.liquid @@ -0,0 +1 @@ +{{title}} \ No newline at end of file diff --git a/demo/nodejs/html.liquid b/demo/nodejs/html.liquid new file mode 100644 index 000000000..98bdac6be --- /dev/null +++ b/demo/nodejs/html.liquid @@ -0,0 +1,7 @@ + +
+ + {% block %}{% endblock %} + {% render "footer.liquid" %} + + \ No newline at end of file diff --git a/demo/nodejs/index.js b/demo/nodejs/index.js index 130099f8d..957b3d5f0 100644 --- a/demo/nodejs/index.js +++ b/demo/nodejs/index.js @@ -2,7 +2,8 @@ const { Liquid } = require('liquidjs') const engine = new Liquid({ root: __dirname, - extname: '.liquid' + extname: '.liquid', + globals: {title: 'LiquidJS Demo'} }) engine.registerTag('header', { @@ -17,8 +18,7 @@ engine.registerTag('header', { }) const ctx = { - todos: ['fork and clone', 'make it better', 'make a pull request'], - title: 'Welcome to liquidjs!' + todos: ['fork and clone', 'make it better', 'make a pull request'] } engine.renderFile('todolist', ctx) diff --git a/demo/nodejs/todolist.liquid b/demo/nodejs/todolist.liquid index 060e08b5e..ff6d19b6b 100644 --- a/demo/nodejs/todolist.liquid +++ b/demo/nodejs/todolist.liquid @@ -1,7 +1,7 @@ -{%header content: "welcome to liquid" | capitalize%} - +{% layout 'html.liquid' %} +{%header content: title | capitalize%}