🚧 Deprecation Notice 🚧
The liquid-node package has been renamed to
liquid, starting at version 4.0.0.
To upgrade:
npm uninstall liquid-node
npm install liquidThe 'liquid-node' package has been renamed to 'liquid'
Node.js port of Tobias Lütke's Liquid template engine.
The liquid-node package has been renamed to
liquid, starting at version 4.0.0.
To upgrade:
npm uninstall liquid-node
npm install liquidnative-or-bluebird so that native Promises are used (thanks @dotnil).include with a file-system layer (very big thanks to @imjoshholloway).default filter (thanks to @sebastianseilund).assign support filters.bluebird a peerDependency.undefined variable Liquid in join-helper.console.log in the library.case tag.LiquidNode always had the Drop class but it never worked
and it was never tested. This has changed with 2.0.0.
In 1.x the template "{{ user.save }}" with the variable configuration
variables =
user:
save: ->
# code
return "ok"would have called save() automatically and thus have rendered ok.
This is now prevented. If you want to allow calling of functions
you have to use a Drop now.
class Droplet extends Liquid.Drop
save: ->
"ok"Promises.(0..5)/(0..foo) are now supported.{% if foo is blank/empty %} didn't work.context.hasKey didn't work.comment now inherits from raw so that inner tags are ignored.isnt wasn't the opposite of is.FilterNotFound was never raised.{{ foo would raise a useless error.truncate filter had an off-by-1 error.raw tag didn't work.bluebird dependency.>=0.10.~ instead of ^.date filter.toString helper used by filters didn't return a String in all cases.undefined | my_filter:123 would output the string my_filter:123.capture tag captured output as an arrays and not as a string.engine.parseAndRender(input, args...) that simplifies engine.parse(input).then (t) -> t.render(args...).engine.parseToken from engine.parse. (API does not break)tokens anymore. It will be passed to parse instead.beforeParse and afterParse hooks to allow better sharing of code.render() that will be concatenated to a string.template.parse() and engine.parse() will return a Promise now.template.parse() is now async-aware. Any Tag can do async parsing now.template.render(assigns [, options]) won't accept filters as second argument anymore.bluebird as implementation for promises - might cause API break.parse() are now objects instead of strings with col, line and value.parse() doesn't accept objects with a source property anymore.engine.registerFilter is now engine.registerFilters.context.addFilters is now context.registerFilters and now takes variadic arguments.Strainer class.Strainers aren't shared between Engines anymore.Liquid.SyntaxErrors now include a location of the error.assign-Tag doesn't wait on fulfillment of promise.mocha for testing.underscore.In Liquid (Ruby) you register tags and additional filters at the Template class. So your project only has a single possible configuration.
+ var engine = new Liquid.Engine;
- Liquid.Template.registerTag(...);
+ engine.registerTag(...);
- var output = Liquid.Template.parse(templateString).renderOrRaise({ foo: 42 });
+ var output = engine.parse(templateString).render({ foo: 42 });Also note that renderOrRaise has been removed, since render has been returning a promise for some time.
The signature of Tag-constructors changed to match render() signature where the
"context" is passed first.
- function(tagName, markup, tokens, template) { ... }
+ function(template, tagName, markup, tokens) { ... }Restores compatibility with 0.1.2 after 0.1.4 introduced the engine which was supposted to be release in a major (or at least minor) release.
blank and empty had odd behaviour on non-arrays[false, true] includes false returned falseinstanceof (thanks @dotnil)q.catch and q.fail calls (they are deprecated).Q.fcalla < b where a and b are async are now parallelizedis and isnt(deprecated)
(deprecated)
Pseudo Public Release
(internal development)