Welcome! This repository contains the code for the U.S. Web Design System (USWDS) documentation website. If you're looking for the main USWDS components and codebase, head over to our USWDS repository.
This site is built using:
Follow the steps below to set up the site on your local machine.
Before getting started, make sure you have the following installed:
Git – Installation guide
Ruby – Version specified in .ruby-version or .tool-versions
Node.js – Version specified in .nvmrc or .tool-versions
Bundler – Version specified in .bundler-version
If you encounter this error:
bundler: failed to load command: jekyll (/usr/share/rvm/gems/ruby-3.0.2/bin/jekyll)
Fix it by running:
gem install ffi -- --disable-system-libffi
Clone the repository:
git clone [email protected]:uswds/uswds-site.git
Navigate into the project folder:
cd uswds-site
Install dependencies:
npm install
bundle install
Start the local server:
npm start
View the site in your browser:
Open http://127.0.0.1:4000 to see the site running locally.
Here are some additional commands you may find helpful:
npm run clean
– Removes copied dependency assets. npm run lint
– Runs eslint
and sass-lint
to check for coding issues. npm test
– Runs all tests and linters. npm run watch
– Watches for changes and automatically rebuilds the site. npm start -- --incremental
or npm run serve
– Runs the site with incremental regeneration to speed up build times.If you need to work with the latest development version of USWDS, follow these steps:
uswds
repository: git clone https://github.com/uswds/uswds.git
uswds
directory and install dependencies: cd uswds
npm install
npm run build
npm link
uswds-site
and link it to the local USWDS version: cd ../uswds-site
npm link uswds
uswds
development server: npm start
LIBRARY_BASE_URL
environment variable: export LIBRARY_BASE_URL="http://127.0.0.1:6006"
npm run serve
npm run watch
📝 Note: Changes to USWDS won’t automatically rebuild the site—you’ll need to manually trigger a rebuild.
To unlink the development version, run:
npm unlink uswds
This site displays USWDS components using pre-built HTML templates from the html-templates
directory. These templates are integrated using a custom library_component
Jekyll tag.
The site is deployed using cloud.gov Pages.
main
branch will automatically update the live site. ⚠️ If a new section fails to build on Pages, try clearing the cache:
bundle update
USWDS code base is included as a Git dependency in package.json
. To update it:
npm install --save "uswds/uswds#commit-hash"
npm install --save "uswds/uswds#v1.3.1"
The version number is automatically detected and displayed on the site. Always use an official version tag for main
branch commits to avoid confusion.
To add an update, see the instructions in the _posts
directory.
Some content on this site is dynamically fetched from GitHub. To avoid API rate limits, you may want to:
export GITHUB_ACCESS_TOKEN="your-token-here"
If you notice outdated data, clear the cache with:
rm -rf .jekyll_get_cache
We welcome contributions! Please review our contributing guidelines before opening an issue or submitting a pull request. These guidelines cover our coding standards and best practices.
We appreciate your contributions to making digital services better and more accessible for everyone. 🚀