Static Sites & Deployment

Build Artifact

Definition

A build artifact is the output of a build step: the folder a tool leaves behind once it has compiled, bundled and minified your source. For a static site that folder is usually named 'dist', 'build', 'out' or 'public', and it contains an 'index.html' at the root plus an assets directory of hashed CSS and JavaScript files. Nothing inside it is meant to be edited by hand. The source — your components, your Markdown, your Sass — stays in the project; the artifact is the derived copy a browser can read without help. Because it is derived, it can be deleted and rebuilt at any time from the same inputs. A site with no tooling has no separate artifact at all: the files you wrote are already the files you serve.

Why It Matters

Uploading the wrong folder is the most common publishing mistake there is. Push the source directory and visitors get a file listing or a page of raw Markdown; push the artifact and they get the site. Artifacts are also the unit worth keeping, because a 2 MB output folder from last Tuesday is a complete working copy of the site as it stood on Tuesday — which is the whole reason rollback is possible. Treating the artifact as disposable keeps repositories small, too. Committing a rebuilt output folder on every change fills the history with thousands of files a machine can regenerate in forty seconds.

How It Works

A generator reads your source files and writes finished ones into an output directory. On the way it resolves imports, concatenates modules, strips comments and whitespace, and renames files with a content hash, so 'main.js' becomes something like 'main.4f2ab9c1.js'. Those hashed names let a cache hold each file for a year, because a changed file arrives under a new name rather than as a new version of an old one. The tool then rewrites the references inside the HTML to point at the hashed names. Whatever lands in that directory — markup, styles, scripts, fonts, images, a robots file copied straight through — is the artifact. Zip it, or point a deployment at it, and there is nothing else to do.

Real-World Example

A designer builds a photography portfolio with a static site generator. The build leaves a 'dist' folder of 41 files and about 6 MB, most of it photographs. She zips that folder, drops the zip into 99helpers, picks a name, and the site is live at 'mara-folio.99helpers.site' a few seconds later. The project on her laptop is nearly a gigabyte with dependencies and never leaves it. When she rebuilds next week and uploads the new zip, the old artifact stays in version history in case the new one looks wrong.

Common Mistakes

  • Uploading the project folder instead of the output folder — visitors get source files and a directory listing rather than a working site
  • Committing the build output to version control — it doubles the size of every change and produces merge conflicts in files nobody wrote
  • Editing a file inside the output folder to make a quick fix — the next build overwrites it, and the change is gone with no trace of why

Related Terms

Put a file online in seconds

Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.

Host a file free →