Skip to content

Enhancement: Add SVG Compression Option for Smaller Embed Size #497

Description

@Avnithakur731-a

Is your feature request related to a problem? Please describe.

Currently, the generated SVG responses include filters, gradients, animations, and formatted spacing that can increase payload size significantly. While the visuals are impressive, larger SVGs may impact:

  • GitHub README loading speed
  • mobile rendering performance
  • bandwidth usage for embeds
  • overall responsiveness on slower networks

There is currently no way to request a lightweight or optimized SVG output for users who prioritize performance over visual effects.

Describe the solution you'd like

Add an optional query parameter such as:

/api/streak?username=octocat&optimize=true

When enabled, the API should:

  • minimize unnecessary whitespace/newlines
  • reduce repeated SVG attributes where possible
  • optionally disable non-essential animations/effects
  • preserve visual correctness and accessibility metadata

The default rendering behavior should remain unchanged unless the optimization flag is explicitly enabled.

Potential implementation areas:

  • lib/svg/generator.ts
  • SVG rendering helpers
  • response utilities
  • optional SVG cleanup/minification utility

Describe alternatives you've considered

An alternative approach could be introducing a separate lightweight theme with fewer effects. However, a dedicated optimization flag would provide more flexibility while keeping the existing theme system unchanged.

Another option could be performing compression at deployment/CDN level, but application-level optimization would give contributors more control over SVG generation behavior.

/claim

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions