push (#614)
* Add support for the Jekyll sample filter See https://jekyllrb.com/docs/liquid/filters I am sorting the array randomly and then picking the first N items or all items if there is no sample limit. * Add tests for `push` I thought `push` was broken because it doesn't work on the Playground but that's not the case. Here are the tests to prove it. Taken from the `concat` tests. * Remove the sample experiment This got in from another branch lol. * Recommend the build:dist command over the whole build This one works for me locally whereas build:docs is reporting some issues. * Return the full `build` command and explain how to use `commitlint` to workshop the message I am working on a PR to make `build` run on macOS because it is a part of the pre-commit hook anyway so all contributors should make it work for them. I have also shown how to check your messages against `commitlint` from the CLI because it is faster than using the VS Code GUI.
liquidjs
A simple, expressive and safe Shopify / Github Pages 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.
- Documentation
- Please star LiquidJS on GitHub!
- Support LiquidJS on Open Collective or Patreon
What's it like?
Basically there're two types of Liquid syntax: tags enclosed by {% %} and outputs enclosed by {{ }}. A Liquid template looks like:
{% if username %}
{{ username | append: ", welcome to LiquidJS!" | capitalize }}
{% endif %}
A live demo is also available and here's a quick tutorial for Liquid syntax.
Installation
Install from npm in Node.js:
npm install liquidjs
Or use the UMD bundle from jsDelivr:
<script src="https://cdn.jsdelivr.net/npm/liquidjs/dist/liquid.browser.min.js"></script>
Or render directly from CLI using npx:
npx liquidjs --template 'Hello, {{ name }}!' --context '{"name": "Snake"}'
For more details, refer to the Setup Guide.
Related Projects
- @11ty/eleventy: A simpler static site generator. An alternative to Jekyll. Written in JavaScript. Transforms a directory of templates (of varying types) into HTML.
- 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
Financial Support
If you love LiquidJS or your company is using LiquidJS? Please consider support us on Open Collective or Patreon.
Backers
If you personally like LiquidJS and find it useful to you, you can buy me a coffee!
Sponsors
If LiquidJS is benefiting your business/company, please sponsor us to contribute to our effort!
Contributors ✨
Want to contribute? see Contribution Guidelines. Thanks goes to these wonderful people: