2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-12 13:47:49 +00:00

fix(tirm): multi lines attributes

This commit is contained in:
BTBMan 2022-09-16 13:10:24 +08:00
parent fd2bff92e1
commit 37733d8045
2 changed files with 16 additions and 1 deletions

View File

@ -4,6 +4,8 @@
export function trimSVG(str: string): string { export function trimSVG(str: string): string {
return ( return (
str str
// Replace multi lines attributes and keep one space between last " or ' of attribute and start letter of next attribute
.replace(/(['"])\s*\n\s*([^>\\/\s])/g, '$1 $2')
// Replace new line only after one of allowed characters that are not part of common attributes // Replace new line only after one of allowed characters that are not part of common attributes
.replace(/(["';{}><])\s*\n\s*/g, '$1') .replace(/(["';{}><])\s*\n\s*/g, '$1')
// Keep one space in case it is inside attribute // Keep one space in case it is inside attribute

File diff suppressed because one or more lines are too long