1.3.2 • Published 3 months ago

liquidless v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

liquidless

Shopify's Liquid template engine, but less powerful. Perfect for configuration files

Get Started

Install the dependency from npm:

npm i liquidless

Import the renderString function

import { renderString } from 'liquidless'

Usage

Example: Rendering a string

renderString('Hello, {{ world }}', { world: 'world!' })

Outputs:

Hello, world!

Example: Using filters

renderString('Hello, {{ world | upcase }}', { world: 'world!' })

Outputs:

Hello, WORLD!

Example: Supplying custom filters

renderString('Hello, {{ world | something: 1, 2, 3 }}', { world: 'world!' }, {
  filters: {
    something: (value, args, variable) => `${value} ${args.join(', ')} (${variable})`
  }
})

Outputs:

Hello, world! 1, 2, 3 (world)

Example: Rending values in an object

import { renderObject } from 'liquidless'
renderObject([{hello: {world: '{{ world }}'}}], { world: 'world!' })

Outputs

[{hello: {world: 'world!'}}]

Filters

  • upcase - converts each character of a string to uppercase
  • downcase - each character of a string to lowercase
  • toInt - converts a value to Int
  • toFloat - converts a value to Float
  • toString - converts a value to String
1.3.2

3 months ago

1.3.1

3 months ago

1.3.0

4 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

12 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago