# liquidjs [](https://www.npmjs.org/package/liquidjs) [](https://www.npmjs.org/package/liquidjs) [](https://travis-ci.org/harttle/liquidjs) [](https://coveralls.io/github/harttle/liquidjs?branch=master) [](https://david-dm.org/harttle/liquidjs) [](#contributors-) [](https://github.com/harttle/liquidjs) [](https://github.com/harttle/liquidjs/issues) [](https://github.com/harttle/liquidjs/graphs/contributors) [](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://opencollective.com/liquidjs) A [shopify][shopify/liquid] compatible [Liquid][tutorial] template engine in pure JavaScript. **The purpose of this repo** is to provide a standard Liquid implementation for the JavaScript community. All features, filters and tags in [shopify/liquid](https://github.com/Shopify/liquid) are supposed to be built in LiquidJS, though there are still some differences and limitations (see below). [Donate to our collective](https://opencollective.com/liquidjs/donate) if you like liquidjs. ## Get Started Install via npm: ```bash npm install --save liquidjs ``` ```javascript var Liquid = require('liquidjs'); var engine = new Liquid(); engine .parseAndRender('{{name | capitalize}}', {name: 'alice'}) .then(console.log); // outputs 'Alice' ``` Or include the UMD build (You may need a [Promise polyfill][pp] for Node.js < 4 and ES5 browsers like [IE and Android UC][caniuse-promises]): ```html ``` Also available from CLI: ```bash echo '{{"hello" | capitalize}}' | npx liquidjs ``` For more tutorials and the full API, refer to the [wiki page](https://github.com/harttle/liquidjs/wiki). ## Differences and Limitations * 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()` Features that available on shopify website but not on shopify/liquid repo will not be implemented in this repo, but there're some plugins available (feel free to add yours): * color filters: https://github.com/harttle/liquidjs-color-filters * sections tags (WIP): https://github.com/harttle/liquidjs-section-tags ## Contributors β¨ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any [kind](https://allcontributors.org/docs/en/emoji-key) are welcome! Thanks goes to these wonderful people: