0.0.16 • Published 6 years ago

nunjucks-watch v0.0.16

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

nunjucks-watch

Greenkeeper badge Build Status Build status codecov

Auto updator for Nunjucks. It resolves location of dependents relative to the rendering target and watch them with chokidar.

Install

npm install nunjucks-watch

Usage

Write result to a file

const nunjucksWatch = require('nunjucks-watch');
const watcher = nunjucksWatch.watch({
	src: 'path/to/your/template.nunjucks',
	dest: 'path/to/dest.html',
	context: {
		foo: 'burn'
	}
});

Receive result as a string

const nunjucksWatch = require('nunjucks-watch');
const watcher = nunjucksWatch.watch({
	src: 'path/to/your/template.nunjucks',
	context: {
		foo: 'burn'
	}
})
	.on('update', function (rendered) {
		console.log(rendered);
	});

API

nunjucksWatch.watch(options)

Start an updator.

options

Type: Object

options.src

Type: String (required)

A path to a file to be rendered.

options.dest

Type: String (optional)

A path to which an updator will write the rendered text.

options.context

Type: Object (optional)

options.context will be used as a context object on rendering.

options.environment

Type: Object (optional)

options.environment will be passed to the nunjucks.Environment constructor.

options.fsLoader.debounce

Type: Number (optional)

Time to wait for debouncing (milliseconds).

License

MIT

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago