nunjucks-webpack-plugin
A webpack plugin for nunjucks
Last updated 2 years ago by evilebottnawi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install nunjucks-webpack-plugin 
SYNC missed versions from official npm registry.

nunjucks-webpack-plugin

NPM version Travis Build Status devDependencies Status peerDependencies Status Greenkeeper badge

A webpack plugin for nunjucks.

Install

npm install --save-dev nunjucks-webpack-plugin

Usage

import NunjucksWebpackPlugin from "nunjucks-webpack-plugin";

export default {
  plugins: [
    new NunjucksWebpackPlugin({
      templates: [
        {
          from: "/path/to/template.njk",
          to: "template.html"
        }
      ]
    })
  ]
};

It is possible to use multiple templates:

import NunjucksWebpackPlugin from "nunjucks-webpack-plugin";

export default {
  plugins: [
    new NunjucksWebpackPlugin({
      templates: [
        {
          from: "/path/to/template.njk",
          to: "template.html"
        },
        {
          from: "/path/to/next-template.njk",
          to: "next-template.html"
        }
      ]
    })
  ]
};

Options

  • templates - (require) array list of templates.

    • from - (require) string path to template.

    • to - (require) string destination path include filename and extension (relative output webpack option).

    • context - (optional) instead global context (see above), see render second argument. The following webpack compilation variables are also sent through to the template under the __webpack__ object:

      • hash
    • callback - (optional) instead global callback (see above), see render third argument.

    • writeToFileEmit - (optional, default: false) - If set to true will emit to build folder and memory in combination with webpack-dev-server

  • configure - (optional) object or nunjucks.Environment see configure options.

Contribution

Feel free to push your code if you agree with publishing under the MIT license.

Changelog

License

Current Tags

  • 5.0.0                                ...           latest (2 years ago)

8 Versions

  • 5.0.0                                ...           2 years ago
  • 4.0.1                                ...           2 years ago
  • 4.0.0                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 14
This Month 66
Last Day 4
Last Week 41
Last Month 127
Dependencies (1)
Dev Dependencies (28)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |