Home Projects Portfolio Dashboard Export PDF Log in
React JavaScript

Modernizing Asset Delivery: Moving to Vector Graphics in React

Relying on pixel-based formats for UI components often leads to blurred icons and unnecessary maintenance headaches. In the dyad project, we recently completed a full migration from legacy PNG assets to a unified SVG-based branding system, ensuring our interface remains crisp across all resolutions.

The Problem with Raster Icons

Previously, managing branding required keeping multiple versions of the same logo in different resolutions. This approach is problematic for several reasons:

  • Scaling issues: Raster images blur when scaled or viewed on high-density Retina displays.
  • Asset bloat: Storing multiple versions of icons increases the application bundle size without a proportional benefit to quality.
  • Maintenance: Replacing a logo requires regenerating every single derivative file.

Transitioning to SVG

By centralizing our branding in an SVG file, we achieve pixel-perfect rendering that scales automatically. Updating the TitleBar component in our React application became a matter of swapping a file reference rather than managing an asset pipeline.

// Before: Using a raster image
<img src="logo_transparent.png" alt="Logo" />

// After: Using the new SVG asset
import Logo from './assets/logo.svg';

const TitleBar = () => (
  <div className="header">
    <img src={Logo} alt="App Logo" />
  </div>
);

In this refactor, we replaced static imports of PNG files with a clean, centralized SVG import. This change not only simplifies the file structure by removing legacy assets but also ensures the icon remains sharp regardless of the zoom level or device pixel ratio.

Clean-Up as a Feature

Replacing assets is only half the battle. A critical part of this refactor was the removal of legacy PNGs (e.g., logo.png, logo_transparent.png) and updating platform-specific icons (.icns and .ico) to match the new branding guidelines. This ensures that the build process is not clogged with dead assets and that the application maintains a consistent visual identity everywhere, from the file system icon to the in-app header.

Key Takeaways

  1. Prefer Vector: Whenever possible, use SVGs for UI elements to future-proof your design.
  2. Clean as you go: When introducing a new branding set, prioritize deleting the old assets to avoid confusion.
  3. Centralize: Define your logo components in one place to make future rebranding efforts trivial.

Generated with Gitvlg.com

Modernizing Asset Delivery: Moving to Vector Graphics in React
JoseDanteArroyo

JoseDanteArroyo

Author

Share: