hapi-nunjucks-helpers

4.3.3 • Public • Published

hapi-nunjucks-helpers

Helpers for hapi-nunjucks

Usage

Use as you would a normal hapijs plugin.

Options

  • assets
    • dist - Directories files are built to. Default: none.
    • mappingFile - File output by clientkit to map hashed assets.
    • endpoint - Base directory for assets. Default: none.
    • cdn - Optional domain for assets. Default: none.
    • cache - If true, caches contents of mappingFile. Default: false

Filters:

asset

Reads from clientkit generated mapping file if available.

<script src="{{ 'common.js' | asset }}"></script>

Also possible to pass a version to force new fetch from cache:

<script src="{{ 'common.js' | asset(2) }}"></script>
<!-- /common.js?v=2 ?>

cdn

Prefixes asset with cdn path from assets.cdn property.

<img src="{{ 'logos/logo.png' | cdn }}">

With css/js

<script src="{{ 'common.js' | asset | cdn }}"></script>

date

Formats a date-string with momentjs

From Now: {{ new Date | date }}
Format String: {{ new Date | date("YYYY MM DD") }}

inline

Takes a file and spits out the contents.

<script>{{ 'common.js' | inline }}</script>

Readme

Keywords

none

Package Sidebar

Install

npm i hapi-nunjucks-helpers

Weekly Downloads

8

Version

4.3.3

License

MIT

Unpacked Size

22.1 kB

Total Files

41

Last publish

Collaborators

  • jga
  • dawnerd
  • ecwillis
  • orthagonal1
  • alaguna
  • aleperez92