How-to
Website
Web app
Install wf on a build machine
This recipe installs wf on a machine that builds the site for you — a CI runner, or the build step of a host such as Netlify — and runs the build there. Every hosting recipe uses it. You need a project that builds with wf build on your own machine, and a build machine with curl and bash.
$ curl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/monzeromer-lab/WebFluent/master/install.sh | WF_VERSION=v7.1.1 bash
$ ~/.webfluent/bin/wf build
How it works
- The install script downloads
wfinto~/.webfluent/bin/.WF_VERSIONpins the release it installs, so a new release cannot change a deploy without you knowing.-fmakescurlfail on an error from the server instead of piping the error page tobash;--proto '=https' --tlsv1.2refuses to fetch the script over anything but HTTPS. ~/.webfluent/bin/wf buildbuilds the project in the current folder and writes the whole site tobuild/. The full path works even where the install has not putwfon thePATHyet.
A static build writes each page as its own index.html (/contact is contact/index.html). A page whose path is * is written to the root as 404.html, which is the file most static hosts serve for a path they have no file for.
Prepare the site before the first deploy
Do these once, before the first deploy:
- Set
meta.site_urlinwebfluent.app.jsonto the address the site will have. If the site lives under a sub-path (/docs), also setbuild.base_path. - Decide between a static build and a single-page build (Static sites and SPAs). A single-page build needs the host to answer every path with
index.html. - Build the site and load it in a real browser:
`wf verify` loads every page in headless Chrome and fails on a script error, a failed request or a blank page.
After the deploy, [check it](/recipes/check-a-deploy).
Variations
Without WF_VERSION, the script installs the latest release:
$ curl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/monzeromer-lab/WebFluent/master/install.sh | bash
To find the latest release, the script asks GitHub's API, which limits how often one address may ask. A shared CI runner often hits that limit, and the install stops with "could not determine the latest version". A pinned WF_VERSION never asks, which is one more reason every hosting recipe pins it.
You can also build on your own machine and upload build/. It is only files.