mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-29 07:05:13 -07:00
docs: include demo for LiquidJS used in browsers, #165
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
# LiquidJS for Browsers
|
||||||
|
|
||||||
|
## Get Started
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd demo/browser
|
||||||
|
npm install
|
||||||
|
npm start
|
||||||
|
```
|
||||||
@@ -1 +0,0 @@
|
|||||||
<h2>Welcome to {{ name | capitalize}}, {% include 'date.html' %}</h2>
|
|
||||||
@@ -13,18 +13,14 @@
|
|||||||
extname: '.html',
|
extname: '.html',
|
||||||
cache: true
|
cache: true
|
||||||
});
|
});
|
||||||
var src = '<h2>Welcome to {{ name | capitalize}}, ' +
|
var src = "<h2>Welcome to {{ name | capitalize}}, {% include 'date.html' %}</h2>";
|
||||||
'access time: {{date|date: "%Y-%m-%d %H:%M:%S"}}</h2>';
|
|
||||||
var ctx = {
|
var ctx = {
|
||||||
name: 'Liquid',
|
name: 'Liquid',
|
||||||
date: new Date()
|
date: new Date()
|
||||||
};
|
};
|
||||||
engine.parseAndRender(src, ctx)
|
engine.parseAndRender(src, ctx)
|
||||||
.then(function(html) {
|
.then(function(html) {
|
||||||
return engine.renderFile('hello', ctx);
|
document.body.innerHTML = html
|
||||||
})
|
|
||||||
.then(function(html) {
|
|
||||||
document.body.innerHTML += html
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# LiquidJS for Express.js
|
||||||
|
|
||||||
|
## Get Started
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd demo/express
|
||||||
|
npm install
|
||||||
|
npm start
|
||||||
|
```
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# LiquidJS for Node.js
|
||||||
|
|
||||||
|
## Get Started
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd demo/nodejs
|
||||||
|
npm install
|
||||||
|
npm start
|
||||||
|
```
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# LiquidJS for TypeScript
|
||||||
|
|
||||||
|
LiquidJS is written in TypeScript and type definitions are available in `liquidjs` package.
|
||||||
|
|
||||||
|
## Get Started
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd demo/typescript
|
||||||
|
npm install
|
||||||
|
npm start
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user