2020-03-24 01:28:17 +08:00
2020-03-10 01:08:25 +08:00
2020-03-28 17:21:07 +08:00
2020-03-28 17:21:07 +08:00
2020-03-10 01:19:40 +08:00
2020-03-28 17:21:07 +08:00
2020-03-28 10:12:33 +00:00
2019-03-02 03:36:33 +08:00
2016-06-13 15:39:31 +08:00

liquidjs

npm version npm downloads coveralls coverage travis Build Status GitHub issues GitHub contributors Open Collective contributors David dependencies David devDependencies DUB license Commitizen friendly semantic-release

A simple, expressive, safe and Shopify compatible template engine in pure JavaScript. The purpose of this repo is to provide a standard Liquid implementation for the JavaScript community so that Jekyll sites, Github Pages and Shopify templates can be ported to Node.js without pain.

Installation

Install from npm in Node.js:

npm install --save liquidjs

Or use the UMD bundle from jsDelivr:

<script src="https://cdn.jsdelivr.net/npm/liquidjs/dist/liquid.min.js"></script>

More details, refer to The Setup Guide.

Differences with Shopify/liquid

All features, filters and tags in shopify/liquid are supposed to be built in LiquidJS, but not those business-logic specific filters/tags which are typically from Shopify themes (see Plugins List in case you're looking for them and feel free to add yours to the list). Though being compatible the Ruby version is one of our priorities, there are still some differences:

  • Dynamic file locating (enabled by default), that means layout/partial names are treated as variables in liquidjs. See #51.
  • Truthy and Falsy. All values except undefined, null, false are truthy, whereas in Ruby Liquid all except nil and false are truthy. See #26.
  • Number. In JavaScript we cannot distinguish or convert between float and integer, see #59. And when applied size filter, numbers always return 0, which is 8 for integer in ruby, cause they do not have a length property.
  • .to_liquid() is replaced by .toLiquid()
  • .to_s() is replaced by JavaScript .toString()
  • Iteration order for objects. The iteration order of JavaScript objects, and thus LiquidJS objects, is a combination of the insertion order for string keys, and ascending order for number-like keys, while the iteration order of Ruby Hash is simply the insertion order.
  • Sort stability. The sort stability is also not defined in both shopify/liquid and LiquidJS, but it's considered stable for LiquidJS in Node.js 12+ and Google Chrome 70+.
  • gulp-liquidjs: A shopify compatible Liquid template engine for Gulp using liquidjs.
  • grunt-liquify: A Grunt task to process Liquid using liquidjs. Use it to add Liquid magic to your scripts and css assets.
  • react-liquid: Liquid templating language component for React
  • @11ty/eleventy: A simpler static site generator. An alternative to Jekyll. Written in JavaScript. Transforms a directory of templates (of varying types) into HTML.

Backers

If you love LiquidJS or your company is using LiquidJS? Please consider support us on Open Collective or Patreon.

backers from open-collective

Contributors

Want to contribute? see Contribution Guidelines. Thanks goes to these wonderful people:

Jun Yang
Jun Yang

🚧 💻
chenos
chenos

💻
Zach Leatherman
Zach Leatherman

🐛
Tim Hardy
Tim Hardy

💻
Paul Robert Lloyd
Paul Robert Lloyd

💻 🐛
Alec Larson
Alec Larson

💻
Patrick Malouin
Patrick Malouin

💻 📖
jaswrks
jaswrks

💻
三三
三三

💻 🤔
ssendev
ssendev

💻 📖
wojtask9
wojtask9

💻
Andrew Barclay
Andrew Barclay

💻
Cory Mawhorter
Cory Mawhorter

💻
Mehdi Jaffery
Mehdi Jaffery

💻
Robin Bijlani
Robin Bijlani

💻 🐛
Ryan Kennedy
Ryan Kennedy

💻
Sami Kukkonen
Sami Kukkonen

💻
Scott Santucci
Scott Santucci

💻
Steven
Steven

💡 💻
azu
azu

📖
Joonas
Joonas

💻
Jamel A.
Jamel A.

💻
Brandon Pittman
Brandon Pittman

💻
tgrandgent
tgrandgent

💻
Martin Schuster
Martin Schuster

💻
Ray
Ray

⚠️ 💻
Cristofer Gonzales
Cristofer Gonzales

💻
S
Description
No description provided
Readme MIT
65 MiB
Languages
TypeScript 94.8%
JavaScript 3.8%
Liquid 0.7%
SWIG 0.3%
Handlebars 0.3%