Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itgalaxy/nunjucks-webpack-plugin
A webpack plugin for nunjucks.
https://github.com/itgalaxy/nunjucks-webpack-plugin
nunjucks webpack webpack-plugin
Last synced: 2 months ago
JSON representation
A webpack plugin for nunjucks.
- Host: GitHub
- URL: https://github.com/itgalaxy/nunjucks-webpack-plugin
- Owner: itgalaxy
- License: mit
- Created: 2017-04-06T12:40:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-15T14:12:09.000Z (over 3 years ago)
- Last Synced: 2024-04-14T00:11:39.730Z (8 months ago)
- Topics: nunjucks, webpack, webpack-plugin
- Language: JavaScript
- Size: 299 KB
- Stars: 27
- Watchers: 7
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# nunjucks-webpack-plugin
[![NPM version](https://img.shields.io/npm/v/nunjucks-webpack-plugin.svg)](https://www.npmjs.org/package/nunjucks-webpack-plugin)
[![Travis Build Status](https://img.shields.io/travis/itgalaxy/nunjucks-webpack-plugin/master.svg?label=build)](https://travis-ci.org/itgalaxy/nunjucks-webpack-plugin)
[![devDependencies Status](https://david-dm.org/itgalaxy/nunjucks-webpack-plugin/dev-status.svg)](https://david-dm.org/itgalaxy/nunjucks-webpack-plugin?type=dev)
[![peerDependencies Status](https://david-dm.org/itgalaxy/nunjucks-webpack-plugin/peer-status.svg)](https://david-dm.org/itgalaxy/nunjucks-webpack-plugin?type=peer)
[![Greenkeeper badge](https://badges.greenkeeper.io/itgalaxy/nunjucks-webpack-plugin.svg)](https://greenkeeper.io)A webpack plugin for nunjucks.
## Install
```shell
npm install --save-dev nunjucks-webpack-plugin
```## Usage
```js
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:
```js
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](https://mozilla.github.io/nunjucks/api.html#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](https://mozilla.github.io/nunjucks/api.html#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](https://mozilla.github.io/nunjucks/api.html#configure) options.## Contribution
Feel free to push your code if you agree with publishing under the MIT license.
## [Changelog](CHANGELOG.md)
## [License](LICENSE)