super-nunjucks-loader

2.0.0 • Public • Published

super-nunjucks-loader

Nunjucks loader for Webpack.

Usage

npm install --save super-nunjucks-loader

And in your Webpack configuration:

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.html/,
        exclude: /(node_modules)/,
        use: ['super-nunjucks-loader'],
        options: {
          globals: {
            PRODUCTION: process.env.NODE_ENV === 'production'
          },
          options: {
            noCache: true
          },
          path: `${__dirname}/src/`
        }
      }
    ]
  }
  // ...
};

Options

Name Description
context Object of variables to pass as Nunjucks context.
globals Variables to add to Nunjucks global scope.
options Options passed into Nunjucks.configure.
path Directory for Nunjucks to find templates.

Then require:

const htmlString = require('./index.html');

Readme

Keywords

none

Package Sidebar

Install

npm i super-nunjucks-loader

Weekly Downloads

9

Version

2.0.0

License

MIT

Unpacked Size

5.33 kB

Total Files

12

Last publish

Collaborators

  • ngokevin