1.2.2 • Published 4 years ago

@fesk/node-nunjucks-runtime v1.2.2

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

Node nunjucks runtime

This is used to load modules created by FESK (nunjucks plugin) and exported using @fesk/node-export. This allows you to use the templates and assets in an express application with zero configuration.

It is currently limited to:

  • Loading nunjucks templates
  • Loading in global variables

In the future it will also:

  • Configure nunjucks with extensions in line with FESK nunjucks
  • Add support for automatically loading view models
  • Add support for automatically validating parameters using JSON Schema (in development)

Usage

import nunjucksRuntime from '@fesk/node-nunjucks-runtime';
import express from 'express';

const app = express();

// where my-fesk-package is the name of your NPM package with your nunjucks assets.
nunjucksRuntime('my-fesk-package', app, {
  // All of these configuration options are optional, usually you won't need these.
  // Any globals you want available to your application.
  globals: {},

  // You can use this to manually set a path to find `my-fesk-package`
  distPath: null,

  // You can change the CWD that will be used to look up the package name.
  cwd: process.cwd(),

  // You can use this as a hook to get access to the express-nunjucks instance and add extra features.
  withNunjucks: njk => {},
});
1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago