mirror of
https://github.com/shadoll/sLogos.git
synced 2026-02-04 11:03:24 +00:00
Clean up SVG files and update logos
- Removed unnecessary XML and DOCTYPE declarations from SVG files. - Eliminated comments within SVG files for cleaner output. - Trimmed leading and trailing whitespace from SVG content. - Ensured all SVG files end with a newline character. - Updated multiple logo SVG files including WireGuard, Wise, WOG, Yahoo, and others to conform to the new standards. - Enhanced the update-data.js script to automate the cleanup process for SVG files.
This commit is contained in:
@@ -190,6 +190,26 @@ function validateAndFixSvg(svgPath) {
|
||||
let svgContent = fs.readFileSync(svgPath, 'utf8');
|
||||
let modified = false;
|
||||
|
||||
// Clean up SVG content
|
||||
const originalContent = svgContent;
|
||||
|
||||
// Remove XML declaration
|
||||
svgContent = svgContent.replace(/<\?xml[^>]*\?>\s*/gi, '');
|
||||
|
||||
// Remove DOCTYPE declaration
|
||||
svgContent = svgContent.replace(/<!DOCTYPE[^>]*>\s*/gi, '');
|
||||
|
||||
// Remove comments
|
||||
svgContent = svgContent.replace(/<!--[\s\S]*?-->/g, '');
|
||||
|
||||
// Remove leading/trailing whitespace and ensure it starts with <svg
|
||||
svgContent = svgContent.trim();
|
||||
|
||||
if (originalContent !== svgContent) {
|
||||
modified = true;
|
||||
console.log(`${path.basename(svgPath)}: Cleaned up SVG (removed XML/DOCTYPE/comments)`);
|
||||
}
|
||||
|
||||
// Parse SVG tag attributes
|
||||
const svgTagMatch = svgContent.match(/<svg[^>]*>/i);
|
||||
if (!svgTagMatch) {
|
||||
|
||||
Reference in New Issue
Block a user