Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
Sam Thorogood edited this page Nov 1, 2021 · 1 revision

Please see web.dev's section on Builds for some context. Both web.dev and developer.chrome.com are based on 11ty. The developer.chrome.com site has various steps around 11ty to correctly build.

You can build a whole production build (one-off) with npm run production, or run a dev server which reloads on changes with npm run dev.

11ty

Like web.dev, we take a reasonably standard approach to 11ty, with a large number of helper filters and shortcodes available to content authors. Its config file is in the usual place. 11ty can be run on its own via eleventy and will build a static version of the site (but it won't have e.g. styles or JS available at all, so you should run npm run dev).

Media

Media shortcodes like {% Img %} and {% Video %} are eventually provided by the webdev-infra project.

Client-Side JS

The "site/_js/main.js" file is included on every page via <script src="..." type="module"> (although there's only a single entrypoint so there's no further import or export statements). There's also "partials/script.js" which is inlined inside a <script> on every page (and does cookie acceptance notices and so on).

Like web.dev, each page can also add pageScripts as part of their front-matter. This is currently only used for the Native Client subtree. This site has far less custom JS than web.dev.

External Data

As part of npm run dev, we (usually) sync the last known good external data. This is important as developer.chrome.com relies on a large set of data which will change over time (not checked-in to git or part of a NPM dependency). See External data. You can also build this directly with npm run build-external.

Gulp

The gulpfile defined in the project completes a small number of pre-build tasks.

Clone this wiki locally