add: demo

This commit is contained in:
harttle
2016-09-26 21:52:23 +08:00
parent ddc17a6b93
commit 83a0a0547e
4 changed files with 46 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
<footer>Copyright @ 2016, Harttle</footer>
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>Welcome to shopify-liquid!</h1>
{% include 'bar' %}
</body>
</html>
+20
View File
@@ -0,0 +1,20 @@
var express = require('express');
var app = express();
var Liquid = require('..');
var engine = Liquid({
root: __dirname, // for layouts and partials
extname: '.liquid'
});
app.engine('liquid', engine.express()); // register liquid engine
app.set('views', __dirname); // specify the views directory
app.set('view engine', 'liquid'); // set to default
app.get('/', function (req, res) {
res.render('foo');
});
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
+14
View File
@@ -0,0 +1,14 @@
{
"name": "express-demo",
"version": "1.0.0",
"description": "Express Demo Using Shopify-Liquid",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "harttle",
"license": "ISC",
"dependencies": {
"express": "^4.14.0"
}
}