Course contentsShow
← Web Development
Lesson 1769 of 2,98233. Static Site Generation and JamstackFree lesson

The Build Process

How SSG frameworks transform source files, fetch data, and output static HTML, CSS, and JavaScript during builds.

The Build Process

You'll learn how SSG frameworks orchestrate multiple steps—source file transformation, data fetching, and HTML generation—to produce a fully static site at build time.

What Happens During a Build?

The build process is like a factory assembly line for your website. Instead of making a product on-demand when a customer orders (like SSR), you manufacture everything in advance, package it, and ship copies whenever requested.

When you run a build command (like npm run build), the SSG framework executes a multi-stage process:

1. Source File Transformation

The framework reads your source files—templates, Markdown, JSX, or other formats—and transforms them into plain HTML. It applies your chosen templating language, converts Markdown to HTML, and processes component files into static markup.

2. Data Fetching

At build time, the framework fetches all necessary data from APIs, databases, or local files. Since this happens once during the build (not on every request), you can make as many data calls as needed without worrying about runtime performance. The data gets baked into the generated pages.

3. Asset Processing

CSS gets compiled from preprocessors (Sass, PostCSS), JavaScript gets bundled and minified, and images get optimized. All assets receive cache-friendly filenames with content hashes.

4. Static Output Generation

The framework writes every page as a standalone HTML file to an output directory (often called dist, build, or public). The result is a folder full of pre-rendered HTML files, CSS, JavaScript, and assets—ready to deploy to any static hosting service.

The entire site exists as flat files before any user visits it.

Key Takeaway: The SSG build process transforms source files and fetches data once at build time, outputting a complete directory of static HTML, CSS, and JavaScript files ready for deployment.