2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-09 14:50:56 +00:00

Merge remote-tracking branch 'btbman/trim' into next

This commit is contained in:
Vjacheslav Trushkin 2022-09-17 16:39:12 +03:00
commit 3b3fb518c3
2 changed files with 16 additions and 1 deletions

View File

@ -4,6 +4,8 @@
export function trimSVG(str: string): string {
return (
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(/(["';{}><])\s*\n\s*/g, '$1')
// Keep one space in case it is inside attribute

File diff suppressed because one or more lines are too long