@volcanic-uk/liquid
v0.0.2
Published
A JS liquid parser with volcanic-related extensions
Downloads
3
Keywords
Readme
Liquid-js
A JS liquid parser with volcanic-related extensions
This project takes a JS Liquid parser from https://github.com/harttle/liquidjs and exntends the language with Volcanic specific tags.
This project is used for validation, identification and sometimes for alternate rendering (using render and import hooks) on the site builder project and the Ixcanul Project.
Usage
import { Liquid } from "@volcanic-uk/liquid";
/*
* currently the <File> interface is an object with the key "content"
* {
* content: "String"
* }
*/
const engine = Liquid({
/*
* This hook is triggered when the engine needs to get the content of the include reference.
* by default the renderer will return nothing
* You need to define this hook to render different content
*/
includeTagContentHook: (reference: string, hex: string) => Promise<File>,
/*
* This hook is triggered when the engine needs to get the content of the tephra reference.
* by default the renderer will only render will use the next hook "tephraTagRenderHook" to render the actual content
* You need to define this hook to get the raw liquid content from your envirnoment
* This hook must return a promise resolving with a File interface
*/
tephraTagContentHook: (reference: string) => Promise<File>,
/*
* This hook is triggered when the engine needs to render the tephra snippet.
* by default the renderer will only render will return the reference as string
* You need to define this hook to get the raw liquid content from your envirnoment
* This Hook must return a promis that resolves a string value that you'd wish to render
*/
tephraTagRenderHook: (reference: string, hex: string, options: Hash, content: File) => Promise<string>
});
Development
This Project is based on TDD bahaviour.
That's been said. there's no browser "development" environment.
The development environment is the test results from Jest.
To start development clone this repo then
npm i
Then
npm run test:watch
Jest will target any file that ends with .test.ts