Skip to content

Commit

Permalink
fix: 🐛 optimize regex handle icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiet Le committed Dec 5, 2024
1 parent 2363b89 commit 38ec618
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "optimize-icons-cli",
"version": "1.1.4",
"version": "1.1.5",
"description": "CLI tool for optimizing icons",
"main": "dist/cli.js",
"types": "dist/types/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/core/icon-optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class IconOptimizer {
* Process SVG content and optimize it
*/
private async processSvgContent(content: string): Promise<ProcessSvgResult> {
const iconRegex = /<svg\s+([^>]*?id="([^"]+)"[^>]*?)>([\s\S]*?)<\/svg>/g;
const iconRegex = /<(\w+)\s+([^>]*?id="([^"]+)"[^>]*?)>([\s\S]*?)<\/\1>/g;
let match: RegExpExecArray | null;
let totalCount = 0;
let removedCount = 0;
Expand Down

0 comments on commit 38ec618

Please sign in to comment.