posthtml-nunjucks

    0.1.1 • Public • Published
    PostHTML

    PostHTML Nunjucks Plugin

    A PostHTML plugin wrapping Nunjucks library.

    npm GitHub Publish codecov

    About

    This is a PostHTML plugin that wraps Nunjucks library.

    Introduction

    This plugin applies a Nunjucks temple to the file being processed:

    Input:

    <div filter="uppercase">{{ name }}</div>

    Output:

    <div>TEST NAME</div>

    Install

    $ npm i posthtml posthtml-nunjucks
    

    Usage

    Provide clear code samples showing how to use the plugin:

    const posthtml = require('posthtml');
    const nunjucks = require('posthtml-nunjucks');
    
    posthtml([nunjucks({ context: { name: 'TEST NAME' } })])
        .process('<div>{{ name }}</div>')
        .then((result) => console.log(result.html));
    
    // <div>TEST NAME</div>

    Options

    The options accepted for the plugin are:

    config

    Type: object
    Default: {}

    Configuration to be passed to nunjucks as specified here.

    context

    Type: object
    Default: {}

    Context to be passed to the templates to be applied, as specified here.

    Install

    npm i posthtml-nunjucks

    DownloadsWeekly Downloads

    4

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    8.94 kB

    Total Files

    11

    Last publish

    Collaborators

    • gguridi