Skip to content

Commit 9229a21

Browse files
committed
feat: update html-bundler-webpack-plugin to v3.14 containing many features and fixes
1 parent 74ef323 commit 9229a21

File tree

4 files changed

+114
-53
lines changed

4 files changed

+114
-53
lines changed

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
# Change log
22

3+
## 5.3.0 (2024-05-31)
4+
5+
- chore: update html-bundler-webpack-plugin
6+
- feat: add `watchFiles.includes` and `watchFiles.excludes` options to allow watch specifically external file,
7+
e.g. *.md file included via Pug filter from any location outer project directory
8+
- feat: add resolving the url() value in the style attribute:
9+
```pug
10+
div(style="background-image: url(./image.png);")
11+
```
12+
- feat: add support for the `css-loader` option `exportType` as [css-style-sheet](https://github.com/webpack-contrib/css-loader?#exporttype)
13+
- feat: add `entryFilter` option to include or exclude entry files when the `entry` option is the path
14+
- feat: add support the [CSS Modules](https://github.com/css-modules/css-modules) for styles imported in JS using the [css-loader modules](https://github.com/webpack-contrib/css-loader#modules) option.\
15+
Required: `css-loader` >= `7.0.0`\
16+
The CSS _module rule_ in the webpack config:
17+
```js
18+
{
19+
test: /\.(css)$/,
20+
use: [
21+
{
22+
loader: 'css-loader',
23+
options: {
24+
modules: {
25+
localIdentName: '[name]__[local]__[hash:base64:5]',
26+
exportLocalsConvention: 'camelCase',
27+
},
28+
},
29+
},
30+
],
31+
},
32+
```
33+
CSS:
34+
```css
35+
.red {
36+
color: red;
37+
}
38+
.green {
39+
color: green;
40+
}
41+
```
42+
Using in JS:
43+
```js
44+
// the styles contains CSS class names: { red: 'main__red__us4Tv', green: 'main__green__bcpRp' }
45+
import styles from './main.css';
46+
```
47+
48+
- feat: add support for dynamic import of styles
49+
```
50+
const loadStyles = () => import('./component.scss');
51+
loadStyles();
52+
```
53+
- fix: issue when used js dynamic import with magic comments /* webpackPrefetch: true */ and css.inline=true
54+
- fix: ansi colors for verbose output in some terminals
55+
- fix: extract CSS from styles imported in dynamically imported JS
56+
357
## 5.2.0 (2024-04-06)
458

559
- feat: add experimental (undocumented) syntax to include (using `?include` query) compiled CSS directly into style tag to allow keep tag attributes

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
## Pug template as entry point
2525

2626
The **Pug Plugin** generates static HTML or [template function](https://github.com/webdiscus/html-bundler-webpack-plugin#template-in-js) from **Pug template** containing source files of scripts, styles, images, fonts and other resources, similar to how it works in [Vite](https://vitejs.dev/guide/#index-html-and-project-root).
27+
This plugin allows using a template file as an [entry point](https://github.com/webdiscus/html-bundler-webpack-plugin#option-entry).
28+
29+
The plugin resolves source files of assets in templates and replaces them with correct output URLs in the generated HTML.
30+
The resolved assets will be processed via Webpack plugins/loaders and placed into the output directory.
31+
You can use a relative path or Webpack alias to a source file.
32+
33+
A template imported in JS will be compiled into [template function](https://github.com/webdiscus/html-bundler-webpack-plugin#template-in-js). You can use the **template function** in JS to render the template with variables in runtime on the client-side in the browser.
2734

2835
## 💡 Highlights
2936

package-lock.json

Lines changed: 50 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pug-plugin",
3-
"version": "5.2.0",
3+
"version": "5.3.0",
44
"description": "Pug plugin for webpack handles a template as an entry point, extracts CSS and JS from their sources referenced in Pug.",
55
"keywords": [
66
"html",
@@ -67,9 +67,9 @@
6767
},
6868
"dependencies": {
6969
"ansis": "2.0.3",
70-
"html-bundler-webpack-plugin": "3.8.0",
70+
"html-bundler-webpack-plugin": "3.14.0",
7171
"js-beautify": "^1.15.1",
72-
"pug": "3.0.2"
72+
"pug": "3.0.3"
7373
},
7474
"devDependencies": {
7575
"@babel/core": "7.24.4",

0 commit comments

Comments
 (0)