2.0.0 • Published 6 years ago

super-nunjucks-loader v2.0.0

Weekly downloads
266
License
MIT
Repository
github
Last release
6 years ago

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

NameDescription
contextObject of variables to pass as Nunjucks context.
globalsVariables to add to Nunjucks global scope.
optionsOptions passed into Nunjucks.configure.
pathDirectory for Nunjucks to find templates.

Then require:

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

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago