Configuration
Every key of webfluent.app.json, its default, and what it changes.
A project's settings live in webfluent.app.json beside src/. Every key is optional except name, so the smallest config is:
json
{ "name": "my-site" }
A key the build does not know is reported with a warning — and the key it most likely meant, so "defaultLocale" says to write default_locale — rather than silently ignored (4.1).
The defaults
This is what a config with only a name means. i18n and offline are absent unless you add them.
json
{
"name": "my-site",
"version": "0.1.0",
"author": "",
"theme": {
"name": null,
"tokens": {},
"builtin": "full",
"dark": null
},
"build": {
"elements": [],
"output": "./build",
"minify": true,
"sourcemap": false,
"ssg": false,
"base_path": "",
"csp": false,
"split": true,
"compress": true,
"budget": {},
"runtime": "auto",
"media": {
"formats": ["webp"],
"widths": [480, 960, 1440, 1920],
"quality": 78,
"pipeline": true
},
"output_type": "spa",
"pdf": {
"page_size": "A4",
"margins": { "top": 72.0, "bottom": 72.0, "left": 72.0, "right": 72.0 },
"default_font": "Helvetica",
"default_font_size": 12.0,
"output_filename": null
},
"slides": {
"size": "16:9",
"width": null,
"height": null,
"default_font": "Helvetica",
"default_font_size": 24.0,
"margin": 60.0,
"show_slide_numbers": false,
"footer_text": null,
"background_color": null,
"chrome_color": null,
"output_filename": null
}
},
"dev": { "port": 3000, "hot_reload": true },
"meta": {
"integrity": {},
"title": "my-site",
"description": "",
"favicon": "",
"touch_icon": "",
"lang": "en",
"site_url": "",
"site_name": "",
"image": "",
"sitemap": true,
"fonts": [],
"stylesheets": []
},
"motion": { "duration": null, "easing": null },
"env": {},
"public_env": []
}
wf init writes a shorter file and turns build.csp on.
The project
| Key | Default | Meaning |
|---|---|---|
|
|
— |
The only required key. The site's name, the PDF's file name when none is given, and |
|
|
|
Yours; nothing in the build reads them. |
build
| Key | Default | Meaning |
|---|---|---|
|
|
|
Where the build is written, relative to the project. |
|
|
|
|
|
|
|
Pre-render every page to its own HTML (chapter 26). |
|
|
|
The sub-path the site is served under, such as |
|
|
|
One script and stylesheet chunk per page, loaded when its route shows. |
|
|
|
Strip comments and whitespace from the scripts and stylesheets. |
|
|
|
Write a source map beside the bundle. |
|
|
|
Write a |
|
|
|
|
|
|
|
Emit a Content-Security-Policy and |
|
|
|
A gzipped size each named output should stay under: |
|
|
|
With |
|
|
below | The image pipeline. |
|
|
below | The paper outputs. |
build.media
| Key | Default | Meaning |
|---|---|---|
|
|
|
The formats every |
|
|
|
The widths written, where smaller than the original. |
|
|
|
The encoding quality, 1–100. |
|
|
|
|
build.pdf
| Key | Default | Meaning |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In points. |
|
|
the project's name | The file written. |
build.slides
| Key | Default | Meaning |
|---|---|---|
|
|
|
|
|
|
|
Explicit points, overriding |
|
|
|
The space around each slide's content; what runs past it is clipped. |
|
|
|
The deck's text. |
|
|
|
|
|
|
|
Text in the bottom-left of every slide. |
|
|
|
A full-bleed colour for every slide. |
|
|
|
The colour of the numbers and footer; unset, it flips between dark and light on the slide's background. |
|
|
the project's name | The file written. |
dev
| Key | Default | Meaning |
|---|---|---|
|
|
|
The port |
|
|
|
Rebuild on a save, reload open tabs, and draw a failed build's error over the page. |
motion
| Key | Default | Meaning |
|---|---|---|
|
|
unset |
How long an animation runs when the element does not say: |
|
|
unset |
How it is paced: a CSS timing function, or a token such as |
meta
| Key | Default | Meaning |
|---|---|---|
|
|
the name, |
What a page falls back to when it declares none. |
|
|
|
The document's language. |
|
|
|
The absolute address. Without it, canonical links, the sitemap's URLs and absolute sharing URLs are left out rather than guessed. |
|
|
|
The name a link preview shows. |
|
|
|
The sharing image for pages that set none. |
|
|
|
The icon a tab shows: a file in |
|
|
|
The icon a phone puts on its home screen: a 180×180 PNG in |
|
|
|
Write |
|
|
|
Web-font stylesheet URLs to link, each with a |
|
|
|
Extra stylesheets to link ahead of |
|
|
|
Subresource-integrity hashes of external assets, by URL. |
theme
| Key | Default | Meaning |
|---|---|---|
|
|
unset |
Which |
|
|
unset |
The theme that stands in for dark mode (chapter 15). |
|
|
|
|
|
|
|
Token values on top of the theme, for a pipeline to supply. |
i18n
json
{ "i18n": { "default_locale": "en", "locales": ["en", "ar"], "dir": "src/translations" } }
| Key | Default | Meaning |
|---|---|---|
|
|
|
The locale a page opens in. |
|
|
|
Every locale; one JSON file each. |
|
|
|
Where the files are. |
env and publicenv
| Key | Default | Meaning |
|---|---|---|
|
|
|
Values read as |
|
|
|
Names a page may read beyond those beginning |
offline
4.1. Absent, no service worker is written.
json
{ "offline": { "precache": ["/", "/docs/*"], "fallback": "/offline", "cache": { "/api/*": "network-first" }, "sync": true } }
| Key | Default | Meaning |
|---|---|---|
|
|
|
The routes a first visit stores, as globs; |
|
|
|
A page's path, shown for a route that was not stored. |
|
|
|
How paths the build did not write are fetched: |
|
|
|
Keep writes made offline and send them later. |
Checked by the test suite
Every code block in the guide is parsed, checked and type-checked on each release.