1.2.5 • Published 5 years ago

@sky-foundry/nunjucks-html-loader v1.2.5

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

SkyFoundry Nunjucks (Webpack) HTML Loader

Nunjucks template loader for Webpack to generate static HTML files.

NPM version Github stars

Setup

You should already have a webpack project setup and a webpack config file in your project.

HTML Webpack Plugin

You should first setup html-webpack-plugin with inject: 'body' and template: 'nunjucks-html-loader!./src/pages/index.njk' (your entry nunjucks template).

plugins: [
  new HtmlWebpackPlugin({
    inject: 'body',
    template: 'nunjucks-html-loader!./src/pages/index.njk',
  }),
]

Webpack Copy Plugin

For images and other assets, the CopyPlugin is best suited for this.

The recommended options are:

plugins: [
  // ... (html webpack plugin and others)
  new CopyPlugin([
    {
      from: '**/*.{jpg,png,gif,svg,woff,eot,ttf}',
      context: 'src',
    },
  ]),
]

TO-DO...

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago