Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.22.0 (2025-11-27)

- fix: preprocessor options for the default preprocessor

## 4.22.0-alpha.0 (2025-07-31)

- feat(experimental): add support for markdown in nunjucks preprocessor
Expand Down
6 changes: 3 additions & 3 deletions src/Plugin/PluginService.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class PluginService {
// add reference for the preprocessor option into the loader options
if (pluginOptions.preprocessor != null && loaderOptions.preprocessor == null) {
loaderOptions.preprocessor = pluginOptions.preprocessor;
}

if (pluginOptions.preprocessorOptions && !loaderOptions.preprocessorOptions) {
loaderOptions.preprocessorOptions = pluginOptions.preprocessorOptions;
}
if (pluginOptions.preprocessorOptions && !loaderOptions.preprocessorOptions) {
loaderOptions.preprocessorOptions = pluginOptions.preprocessorOptions;
}

context = {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
</head>
<body>
<!-- path to partials directory -->
<div>header</div>
<nav>Navigation</nav>
<h1>Breaking Bad</h1>
<ul class="people">
<li>Walter White</li>
<li>Jesse Pinkman</li>
</ul>
<img src="assets/img/apple.02a7c382.png" alt="apple" />
<!-- path to partials directory -->
<div>footer</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title><%= it.title %></title>
</head>
<body>
<!-- path to partials directory -->
<%~ include('src/views/partials/header.html') %>
<%~ include('src/views/pages/includes/nav.html') %>
<h1><%= it.headline %></h1>
<ul class="people">
<% for (let i = 0; i < it.people.length; i++) {%>
<li><%= it.people[i] %></li>
<% } %>
</ul>
<img src="@images/apple.png" alt="apple" />
<!-- path to partials directory -->
<%~ include('src/views/partials/footer.html') %>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<nav>Navigation</nav>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div>footer</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div>header</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const path = require('path');
const HtmlBundlerPlugin = require('@test/html-bundler-webpack-plugin');

module.exports = {
mode: 'production',

output: {
path: path.join(__dirname, 'dist/'),
},

resolve: {
alias: {
'@images': path.join(__dirname, '../../../fixtures/images'),
},
},

plugins: [
new HtmlBundlerPlugin({
entry: {
index: {
import: './src/views/pages/home.html',
data: {
title: 'Home',
headline: 'Breaking Bad',
people: ['Walter White', 'Jesse Pinkman'],
},
},
},
// test default preprocessor (eta) and preprocessorOptions
preprocessorOptions: { useWith: false },
}),
],

module: {
rules: [
{
test: /\.(png|svg|jpe?g|webp)$/i,
type: 'asset/resource',
generator: {
filename: 'assets/img/[name].[hash:8][ext]',
},
},
],
},
};
1 change: 1 addition & 0 deletions test/preprocessor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ beforeAll(() => {

describe('Eta', () => {
test('default', () => compareFiles('_preprocessor/eta-default'));
test('default with options', () => compareFiles('_preprocessor/eta-default-with-options'));
test('option views', () => compareFiles('_preprocessor/eta-option-views'));
test('option async', () => compareFiles('_preprocessor/eta-option-async'));
test('include md', () => compareFiles('_preprocessor/eta-include-md'));
Expand Down