# liquidjs [](https://www.npmjs.org/package/liquidjs) [](https://www.npmjs.org/package/liquidjs) [](https://coveralls.io/github/harttle/liquidjs?branch=master) [](https://travis-ci.org/harttle/liquidjs) [](https://github.com/harttle/liquidjs/issues) [](https://github.com/harttle/liquidjs/graphs/contributors) [](https://opencollective.com/liquidjs) [](https://david-dm.org/harttle/liquidjs) [](https://david-dm.org/harttle/liquidjs?type=dev) [](https://github.com/harttle/liquidjs/blob/master/LICENSE) [](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits) [](https://github.com/harttle/liquidjs) A simple, expressive, safe and [Shopify][shopify/liquid] 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](https://jekyllrb.com), [Github Pages](https://pages.github.com/) and [Shopify templates](https://themes.shopify.com/) can be ported to Node.js without pain. * [Documentation][doc] * Please star [LiquidJS on GitHub][github]! * Support [LiquidJS on Open Collective][oc] or [Patreon][patreon] ## Installation Install from npm in Node.js: ```bash npm install --save liquidjs ``` Or use the UMD bundle from jsDelivr: ```html ``` More details, refer to [The Setup Guide][setup]. ## Differences with Shopify/liquid All features, filters and tags in [shopify/liquid](https://github.com/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][plugins] 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](https://github.com/harttle/liquidjs/issues/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](https://github.com/harttle/liquidjs/pull/26). * Number. In JavaScript we cannot distinguish or convert between `float` and `integer`, see [#59](https://github.com/harttle/liquidjs/issues/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()](https://github.com/Shopify/liquid/wiki/Introduction-to-Drops) is replaced by `.toLiquid()` * [.to_s()](https://www.rubydoc.info/gems/liquid/Liquid/Drop) 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](https://shopify.github.io/liquid/filters/sort/) stability is also not defined in both shopify/liquid and LiquidJS, but it's [considered stable](https://v8.dev/features/stable-sort) for LiquidJS in Node.js 12+ and Google Chrome 70+. ## Related Packages * [gulp-liquidjs](https://www.npmjs.com/package/@tuanpham-dev/gulp-liquidjs): A shopify compatible Liquid template engine for Gulp using liquidjs. * [grunt-liquify](https://www.npmjs.com/package/grunt-liquify): A Grunt task to process Liquid using liquidjs. Use it to add Liquid magic to your scripts and css assets. * [react-liquid](https://github.com/aquibm/react-liquid#readme): Liquid templating language component for React * [@11ty/eleventy](https://www.npmjs.com/package/@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][financial-support].  ## Contributors β¨ Want to contribute? see [Contribution Guidelines][contribution]. Thanks goes to these wonderful people: