HTML Build Tools
Getting set up
Make sure you have
git installed on your system, and you are using a Bash shell. (On Windows,
cmd.exe will not work, but the Git Bash shell that comes with Git for Windows works nicely.)
Then, clone this (html-build) repo:
git clone https://github.com/whatwg/html-build.git && cd html-build
You then have a decision to make as to how you want to do your builds: locally, on your computer, or using a Docker container. We suggest going the Docker route if and only if you are already comfortable with Docker.
To build locally, you'll need the following commands installed on your system:
Optionally, for faster builds, you can install Wattsi and Python 3.7+ (necessary for applying syntax highlighting to
pre contents). If you don't bother with that, the build will use Wattsi Server, which requires an internet connection.
Running the build
build.sh script from inside your
html-build working directory, like this:
The first time this runs, it will look up for the HTML source from a
../html folder, if it exists. Otherwise, it may ask for your input on where to clone the HTML source from, or where on your system to find it if you've already done that. If you're working to submit a pull request to whatwg/html, be sure to give it the URL of your fork.
You may also set the environment variable
$HTML_SOURCE to use a custom location for the HTML source. For example:
Building using a Docker container
The Dockerized version of the build allows you to run the build entirely inside a "container" (lightweight virtual machine). This includes tricky dependencies like a local copy of Wattsi and Python.
To perform a Dockerized build, use the
The first time you do this, Docker will download a bunch of stuff to set up the container properly, but subsequent runs will simply build the standard and be very fast.
If you get permissions errors on Windows, you need to first configure your
html/ directories to be shareable with Docker.
After you complete the build steps above, the build will run and generate the single-page version of the spec, the multipage version, and more. If all goes well, you should very soon have an
output/ directory containing important files like
You can also use the
--serve option to
build.sh to automatically serve the results on
https://localhost:8080/ after building (as long as you Python 3.7+ installed).
Now you're ready to edit the
html/source file—and after you make your changes, you can run the
build.sh script again to see the new output.
Fast local iteration
There are a number of options to disable certain parts of the build process to speed up local iteration. Run
./build.sh help to see them all, or just use the
--fast flag to get maximally-fast builds.
A note on Git history
Your clone doesn't need the HTML standard's complete revision history just for you to build the spec and contribute patches. So, if you use
build.sh to create the clone, we don't start you out with a clone of the history. That makes your first build finish much faster. And if later you decide you do want to clone the complete history, you can still get it, by doing this:
cd ./html && git fetch --unshallow
That said, if you really do want to start out with the complete history of the repo, then run the build script for the first time like this:
That will clone the complete history for you. But be warned: It'll make your first build take dramatically longer to finish!