Skip to content

Commit e78489f

Browse files
Potential fix for code scanning alert no. 5: Incomplete multi-character sanitization
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent eb6d3b8 commit e78489f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/vue-cli-plugin-purgecss/generator/templates/postcss.config.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ module.exports = {
66
require("@fullhuman/postcss-purgecss")({
77
content: [`./public/**/*.html`, `./src/**/*.vue`],
88
defaultExtractor(content) {
9-
const contentWithoutStyleBlocks = content.replace(
10-
/<style[^]+?<\/style>/gi,
11-
""
12-
);
9+
let previous;
10+
let contentWithoutStyleBlocks = content;
11+
do {
12+
previous = contentWithoutStyleBlocks;
13+
contentWithoutStyleBlocks = contentWithoutStyleBlocks.replace(
14+
/<style[^]+?<\/style>/gi,
15+
""
16+
);
17+
} while (contentWithoutStyleBlocks !== previous);
1318
return (
1419
contentWithoutStyleBlocks.match(
1520
/[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g

0 commit comments

Comments
 (0)