@sky-foundry/nunjucks-html-loader
v1.2.5
Published
A webpack loader that takes nunjucks templates and returns raw html. It also works with webpack's watch command
Downloads
2
Readme
SkyFoundry Nunjucks (Webpack) HTML Loader
Nunjucks template loader for Webpack to generate static HTML files.
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...