This commit is contained in:
tatianamac
2019-11-26 14:50:43 -08:00
parent 8a55660ed0
commit 6d5445ecc5
13894 changed files with 2233957 additions and 0 deletions

22
node_modules/liquidjs/demo/express/app.js generated vendored Normal file
View File

@ -0,0 +1,22 @@
const express = require('express')
const Liquid = require('../..')
let app = express()
let engine = Liquid({
root: __dirname, // for layouts and partials
extname: '.liquid'
})
app.engine('liquid', engine.express()) // register liquid engine
app.set('views', ['./partials', './views']) // specify the views directory
app.set('view engine', 'liquid') // set to default
app.get('/', function (req, res) {
let todos = ['fork and clone', 'make it better', 'make a pull request']
res.render('todolist', {
todos: todos,
title: 'Welcome to liquidjs!'
})
})
module.exports = app

5
node_modules/liquidjs/demo/express/index.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
const app = require('./app.js')
app.listen(3000, function () {
console.log('Express running: http://localhost:3000')
})

15
node_modules/liquidjs/demo/express/package.json generated vendored Normal file
View File

@ -0,0 +1,15 @@
{
"name": "express-demo",
"version": "1.0.0",
"description": "Express Demo Using liquidjs",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "harttle",
"license": "MIT",
"dependencies": {
"express": "^4.14.0"
}
}

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{title}}</title>
</head>
<body>
<h1>{{title}}</h1>
{% block %}{% endblock %}
<footer> {% block footer %}{% endblock %} </footer>
</body>
</html>

View File

@ -0,0 +1 @@
{{id}} - {{todo}}

View File

@ -0,0 +1,11 @@
{% layout 'layout' %}
<ul>
{% for todo in todos %}
<li>{% include 'todo', id:forloop.index %}</li>
{% endfor %}
</ul>
{% block 'footer' %}
Copyright @ 2016, Harttle
{% endblock %}