mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
rename to liquidjs
This commit is contained in:
@@ -1,34 +1,35 @@
|
||||
# shopify-liquid
|
||||
# liquidjs
|
||||
|
||||
[](https://www.npmjs.org/package/shopify-liquid)
|
||||
[](https://travis-ci.org/harttle/shopify-liquid)
|
||||
[](https://coveralls.io/github/harttle/shopify-liquid?branch=master)
|
||||
[](https://github.com/harttle/shopify-liquid/issues)
|
||||
[](https://www.npmjs.org/package/liquidjs)
|
||||
[](https://travis-ci.org/harttle/liquidjs)
|
||||
[](https://coveralls.io/github/harttle/liquidjs?branch=master)
|
||||
[](https://github.com/harttle/liquidjs/issues)
|
||||
|
||||
A Liquid template engine with a wide range of tags and filters,
|
||||
for both Node.js and browsers.
|
||||
Here's a live demo: <http://harttle.com/shopify-liquid/>
|
||||
A Liquid engine implementation for both Node.js and browsers, with all [shopify/liquid][shopify/liquid] features.
|
||||
Formerly known as shopify-liquid.
|
||||
|
||||
Live Demo: <http://harttle.com/liquidjs/>
|
||||
|
||||
> The Liquid template engine is implemented in Ruby originally,
|
||||
> which is used by [Jekyll][jekyll] and [Github Pages][gh].
|
||||
|
||||
Features:
|
||||
|
||||
* A wide range of [filters](https://github.com/harttle/shopify-liquid/wiki/Builtin-Filters) and [tags](https://github.com/harttle/shopify-liquid/wiki/Builtin-Tags)
|
||||
* A wide range of [filters](https://github.com/harttle/liquidjs/wiki/Builtin-Filters) and [tags](https://github.com/harttle/liquidjs/wiki/Builtin-Tags)
|
||||
* Easy tag/filter registration, allows async tags
|
||||
* [any-promise][any-promise]
|
||||
|
||||
API Reference:
|
||||
|
||||
* Builtin Tags: <https://github.com/harttle/shopify-liquid/wiki/Builtin-Tags>
|
||||
* Builtin Filters: <https://github.com/harttle/shopify-liquid/wiki/Builtin-Filters>
|
||||
* Operators: <https://github.com/harttle/shopify-liquid/wiki/Operators>
|
||||
* Whitespace Control: <https://github.com/harttle/shopify-liquid/wiki/Whitespace-Control>
|
||||
* Builtin Tags: <https://github.com/harttle/liquidjs/wiki/Builtin-Tags>
|
||||
* Builtin Filters: <https://github.com/harttle/liquidjs/wiki/Builtin-Filters>
|
||||
* Operators: <https://github.com/harttle/liquidjs/wiki/Operators>
|
||||
* Whitespace Control: <https://github.com/harttle/liquidjs/wiki/Whitespace-Control>
|
||||
|
||||
Installation:
|
||||
|
||||
```bash
|
||||
npm install --save shopify-liquid
|
||||
npm install --save liquidjs
|
||||
```
|
||||
|
||||
## Render from String
|
||||
@@ -36,7 +37,7 @@ npm install --save shopify-liquid
|
||||
Parse and Render:
|
||||
|
||||
```javascript
|
||||
var Liquid = require('shopify-liquid');
|
||||
var Liquid = require('liquidjs');
|
||||
var engine = Liquid();
|
||||
|
||||
engine.parseAndRender('{{name | capitalize}}', {name: 'alice'})
|
||||
@@ -126,11 +127,11 @@ And `window.Liquid` is what you want. There's also a [demo](demo/browser/).
|
||||
var engine = window.Liquid();
|
||||
var src = '{{ name | capitalize}}';
|
||||
var ctx = {
|
||||
name: 'welcome to Shopify Liquid'
|
||||
name: 'welcome to liquidjs'
|
||||
};
|
||||
engine.parseAndRender(src, ctx)
|
||||
.then(function(html) {
|
||||
// html === Welcome to Shopify Liquid
|
||||
// html === Welcome to liquidjs
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
@@ -194,7 +195,7 @@ engine.registerFilter('upper', function(v){
|
||||
});
|
||||
```
|
||||
|
||||
> See existing filter implementations: <https://github.com/harttle/shopify-liquid/blob/master/filters.js>
|
||||
> See existing filter implementations: <https://github.com/harttle/liquidjs/blob/master/filters.js>
|
||||
|
||||
## Register Tags
|
||||
|
||||
@@ -211,7 +212,7 @@ engine.registerTag('upper', {
|
||||
});
|
||||
```
|
||||
|
||||
> See existing tag implementations: <https://github.com/harttle/shopify-liquid/blob/master/tags/>
|
||||
> See existing tag implementations: <https://github.com/harttle/liquidjs/blob/master/tags/>
|
||||
|
||||
## Contribution Guide
|
||||
|
||||
@@ -221,11 +222,11 @@ engine.registerTag('upper', {
|
||||
|
||||
[nunjucks]: http://mozilla.github.io/nunjucks/
|
||||
[liquid-node]: https://github.com/sirlantis/liquid-node
|
||||
[shopify-liquid]: https://shopify.github.io/liquid/
|
||||
[shopify/liquid]: https://shopify.github.io/liquid/
|
||||
[jekyll]: http://jekyllrb.com/
|
||||
[gh]: https://pages.github.com/
|
||||
[releases]: https://github.com/harttle/shopify-liquid/releases
|
||||
[releases]: https://github.com/harttle/liquidjs/releases
|
||||
[any-promise]: https://github.com/kevinbeaty/any-promise
|
||||
[test]: https://github.com/harttle/shopify-liquid/tree/master/test
|
||||
[test]: https://github.com/harttle/liquidjs/tree/master/test
|
||||
[caniuse-promises]: http://caniuse.com/#feat=promises
|
||||
[whitespace control]: https://github.com/harttle/shopify-liquid/wiki/Whitespace-Control
|
||||
[whitespace control]: https://github.com/harttle/liquidjs/wiki/Whitespace-Control
|
||||
|
||||
+16
-16
@@ -1,22 +1,22 @@
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
var Liquid = require('../..');
|
||||
var express = require('express')
|
||||
var app = express()
|
||||
var Liquid = require('../..')
|
||||
|
||||
var engine = Liquid({
|
||||
root: __dirname, // for layouts and partials
|
||||
extname: '.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.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) {
|
||||
var todos = ['fork and clone', 'make it better', 'make a pull request'];
|
||||
res.render('todolist', {
|
||||
todos: todos,
|
||||
title: 'Welcome to shopify-liquid!'
|
||||
});
|
||||
});
|
||||
var todos = ['fork and clone', 'make it better', 'make a pull request']
|
||||
res.render('todolist', {
|
||||
todos: todos,
|
||||
title: 'Welcome to liquidjs!'
|
||||
})
|
||||
})
|
||||
|
||||
module.exports = app;
|
||||
module.exports = app
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "express-demo",
|
||||
"version": "1.0.0",
|
||||
"description": "Express Demo Using Shopify-Liquid",
|
||||
"description": "Express Demo Using liquidjs",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "harttle",
|
||||
"license": "ISC",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"express": "^4.14.0"
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "shopify-liquid",
|
||||
"name": "liquidjs",
|
||||
"version": "1.9.0",
|
||||
"description": "A feature-rich Liquid template engine for Node.js and browsers, with compliance with the Ruby version.",
|
||||
"description": "A Liquid template engine for Node.js and browsers, with all shopify/liquid features.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint src/ test/",
|
||||
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/harttle/shopify-liquid.git"
|
||||
"url": "git+https://github.com/harttle/liquidjs.git"
|
||||
},
|
||||
"keywords": [
|
||||
"liquid",
|
||||
@@ -25,9 +25,9 @@
|
||||
"author": "Harttle",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/harttle/shopify-liquid/issues"
|
||||
"url": "https://github.com/harttle/liquidjs/issues"
|
||||
},
|
||||
"homepage": "https://github.com/harttle/shopify-liquid#readme",
|
||||
"homepage": "https://github.com/harttle/liquidjs#readme",
|
||||
"dependencies": {
|
||||
"any-promise": "^1.3.0"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user