
Summary
Key points of this document
- Where are the design challenges?
- How to define the boundaries
- Details that matter in implementation
Overview
Static HTML sites are simple and stable, but managing them becomes difficult as pages and assets grow. When moving to Vite management, it's realistic to start with building and asset organization rather than a complete overhaul. The purpose of migrating static HTML to Vite management is not to switch to a trendy tool, but to make asset dependencies and build results reproducible.
Where are the design challenges?
As handwritten HTML increases, common header correction omissions, scattered image paths, CSS duplication, and leftover unnecessary files occur. However, frameworking a stable site all at once increases risk.
Existing sites may have search rankings, external links, and QR codes on printed materials tied to them. Carelessly changing URL structures or metadata can lead to operational problems, even if technically functional.
In long-running static HTML sites, copied CSS, unused JavaScript, relative paths, and manually compressed images tend to be mixed. Even if the appearance works, it becomes difficult to know what will be affected by changes.
How to define the boundaries
In the first phase, we'll move to a configuration that can be built with Vite, preserving HTML content and URLs as much as possible. Next, we'll proceed with common CSS, image optimization, and componentization. There's also the option not to React-ify until necessary.
In the design phase, we first inventory current URLs, common parts, assets, forms, and external scripts. When moving to Vite, we maintain the URL structure while modularizing common CSS and JS, making them ready for delivery as build artifacts.
Details that matter in implementation
Organize Vite entries, separating assets under public from build targets. CSS is divided into global base styles and page-specific styles, and JavaScript is loaded only on necessary pages.
With Vite, organize per-page entries, common CSS, image imports, and static public placement. Instead of React-ifying existing HTML all at once, it's also effective to componentize only necessary pages and leave simple pages in a form close to HTML.
- First, list existing URLs and redirects to prevent broken links during migration.
- Separate assets placed in
publicfrom assets imported and managed by hash. - Check the HTML after building to see if
title,description, OGP, andcanonicalare maintained.
Observe how it breaks
For verification, compare links, images, OGP, forms, 404s, and mobile display of all pages before and after migration. Check the dist folder after building with a local preview to see if relative paths are broken.
For verification, check the display of representative pages, images, forms, links, meta tags, and 404s. Running main user flows with a link checker or Playwright can catch relative path issues easily overlooked by manual checks.
Discarded options and trade-offs
Even after moving to Vite, duplication will remain if common components are not created. On the other hand, a major overhaul from the start increases release risk. Prioritizing stability through phased migration may be more appropriate.
Converting everything to an SPA at once incurs high migration costs. Even just moving to Vite management offers benefits in building, dependency management, and asset optimization. It's important to decide, based on your objectives, to leave some scope for improvement while retaining static HTML.
Decision criteria to retain on-site
Modernizing static HTML can start with improving management methods rather than introducing a framework. By moving to build management while preserving URLs and appearance, subsequent improvements become easier.
Modernizing a static site can proceed without a complete overhaul. Simply preserving URLs and making it reproducible with a build significantly improves maintainability.


