for css
{% for name, item in bundles.css %}
<link rel="stylesheet" href="{{ item }}">
{% endfor %}
or
<link rel="stylesheet" href="{{ bundles.css['entry_point_name'] }}">
for js
{% for name, item in bundles.js %}
<script src="{{ item }}"></script>
{% endfor %}
or
<script src="{{ bundles.js['entry_point_name'] }}"></script>
- adding variables, filters and parameters using htmlPlugin function
plugins: [
...htmlPlugin({
pagesPath: paths.pages,
templatePath: paths.templates,
outputPath: paths.output,
data: {
foo: 'bar',
title: 'site-title'
},
filters: {
shorten: function (value, count) {
return value.slice(0, count || 5);
}
}
}, {
// ...HTML Webpack Plugin options
minify: false,
inject: false,
chunks: {
index: [
'firstEntry',
'secondEntry'
],
about: [
'firstEntry'
]
}
}, {
// ...nunjucks options
})
]
- added example app, to run:
run npm i && npm run (start or build)