1.1.0 • Published 4 years ago

alar-pug-loader v1.1.0

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

Alar-Pug-Loader

Pug loader for Alar framework.

When using this loader, pug files can be loaded as Alar modules and take benefits of auto-loading and hot-reloading.

For information about pug, please visit https://www.npmjs.com/package/pug.

Example

import { ModuleProxy } from "alar";
import { PugLoader } from "alar-pug-loader";

var view = new ModuleProxy("views", __dirname + "/views");

view.setLoader(new PugLoader());

// assume there is hello.pug file in views
// every pug module instance (PugLoader.View) has a render method and accepts an
// argument as data parsed to the template.
view.hello.instance().render({ /* data */ });

API

new PugLoader(options?: PugLoader.Options)

Interface Options includes:

  • encoding?: string Specifies encoding for loading the template (default: utf8).
  • compileDebug: boolean If true, the function source will be included in the compiled template for better error messages (sometimes useful in development). It is enabled by default, unless used with Express in production mode.
  • debug: boolean If true, the tokens and function body are logged to stdout.
  • filters: object Hash table of custom filters. Defaults to undefined.
  • globals: string[] List of global names to make accessible in templates.
1.1.0

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago