npm.io
1.1.4 • Published 2 months agoCLI

kirby-template-sugar

Licence
MIT
Version
1.1.4
Deps
4
Size
56 kB
Vulns
0
Weekly
0
Stars
43

Kirby Template Sugar

CLI Usage

No need to install the package, just run it with npx.

Build

Compile all files inside site/templates and site/snippets into site/dist.
Note: we're using site as the root folder, so the other paths will be relative to it.

npx kirby-template-sugar "{templates,snippets}/*.kirby" --root site --outDir dist
Development

Same as build but with the --watch flag

npx kirby-template-sugar "{templates,snippets}/*.kirby" --root site --outDir dist --watch

Manual Usage

Install the package with

npm i kirby-template-sugar -D

and then

import { transform, transformFiles, watchFiles } from 'kirby-template-sugar'

const options = { root: 'src', outDir: 'dist' }

// either watch files
watchFiles('**/*.kirby', options)

// or compile them once
transformFiles('**/*.kirby', options)

// or compile a string
const result = transform(`<k:test $prop="<? true ?>" />`)