Features

Installation

  • Node.js
    npm install --save liquidjs
  • Browser (production)
    <script src="//unpkg.com/liquidjs/dist/liquid.min.js"></script>
  • Browser (development)
    <script src="//unpkg.com/liquidjs/dist/liquid.js"></script>
  • Browser Demo

    Here's a JSFiddle: https://jsfiddle.net/6u40xbzs/1/

    Node.js Demo

    var Liquid = require('liquidjs');
    var engine = Liquid();
    
    engine
        .parseAndRender('{{name | capitalize}}', {name: 'alice'})
        .then(console.log);
    
    // outputs 'Alice'

    Debugging

    Syntax error will be located in error.message:

       3| {% assign contributors="harttle,chenos,thardy,..." | split: "," %}
       4| <ul>
    >> 5| {% for person in contributors %}
       6| <li>{{ person }}</li>
       8| </ul>
    ParseError: tag {% for person in contributors %} not closed, line:5
        at parseToken (https://unpkg.com/liquidjs@2.1.2/dist/liquid.js:791:13)
        at Object.parse (https://unpkg.com/liquidjs@2.1.2/dist/liquid.js:772:22)
        at Object.parse (https://unpkg.com/liquidjs@2.1.2/dist/liquid.js:258:24)
        at https://unpkg.com/liquidjs@2.1.2/dist/liquid.js:269:20
        at <anonymous>
    See this JSFiddle: https://jsfiddle.net/d86qj6yb/6/

    API Reference

    Refer to README.md for detailed usage and options. See wiki for API references: