diff --git a/CHANGELOG.md b/CHANGELOG.md index 863eabeb..955b0541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change log +## 4.5.3 (2024-11-28) + +- fix: issue by HMR when CSS contains Tailwind-like style names with backslashes + E.g.: `.\32xl\:w-96`, `.lg\:ml-4` + ## 4.5.2 (2024-11-28) - fix: issue by HMR when CSS contains a comment with `back-tick` quotes diff --git a/package.json b/package.json index 3b82257a..d6567cfe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-bundler-webpack-plugin", - "version": "4.5.2", + "version": "4.5.3", "description": "HTML Bundler Plugin for Webpack renders HTML templates containing source files of scripts, styles, images. Supports template engines: Eta, EJS, Handlebars, Nunjucks, Pug, TwigJS. Alternative to html-webpack-plugin.", "keywords": [ "html", diff --git a/src/Loader/cssLoader.js b/src/Loader/cssLoader.js index 4ebc764e..e500e2c0 100644 --- a/src/Loader/cssLoader.js +++ b/src/Loader/cssLoader.js @@ -81,9 +81,10 @@ const pitchLoader = async function (remaining) { if (isHmr) { let css = result.default.toString(); - const search = /\n|`/g; + const search = /\n|\\|`/g; const replacements = { '\n': '', + '\\': '\\\\', '`': '\\`', }; diff --git a/test/cases/option-css-hot-dev/expected/index.html b/test/cases/option-css-hot-dev/expected/index.html index 706542ca..045b577a 100644 --- a/test/cases/option-css-hot-dev/expected/index.html +++ b/test/cases/option-css-hot-dev/expected/index.html @@ -4,7 +4,7 @@