Type
Config
From mothwing ยท src/config.js:11
What a site's mothwing.config.js default exports. Only domain is needed. Paths are relative to src unless they say otherwise. The extras (minify to activeLinks) are off until asked for: true turns one on as it comes, an object with its own settings.
Properties
domain | string | "example.com", for the canonical URLs, sitemaps and CNAME |
|---|---|---|
srcoptional | string | The source folder, relative to the config. "src" |
outoptional | string | The build folder, relative to the config. "dist" |
pagesoptional | string | The pages folder. "pages" |
partialsoptional | string | The partials folder, left out of the build. <x-html> takes a partial from anywhere in src, this is only the folder that isn't copied. "partials" |
dataoptional | string | The data folder, its files are in every page by their name: projects.json -> {{ projects }}. Left out of the build. "data" |
notFoundoptional | string | The 404 page, in the pages folder. Kept in the build's root, out of the sitemap. "404.html" |
jsoptional | JsConfig | The JS to bundle |
sassoptional | Record<string, string> | Sass to compile, source to output: { "scss/index.scss": "css/index.css" }. Needs sass installed |
excludeoptional | string[] | Folders left out of the build, on top of pages, partials and data: ["js", "scss"] |
rerenderoptional | string[] | Folders and files the pages read with fs, whose changes render every page again in dev. They can be outside src, "../README.md", and are watched too, Sass in them builds the CSS first. What the pages import, include or use from the data folder is followed on its own |
seooptional | SeoConfig | For <x-seo> |
minifyoptional | boolean | Minify the HTML of production builds: comments and the whitespace that doesn't show are taken out, and esbuild minifies the inline scripts and styles. The tags and their attributes stay as written |
cspoptional | boolean | Record<string, string> | A Content-Security-Policy <meta> that allows only the site's own files, and its inline scripts by their hash. An object sets directives over the defaults: { "style-src": "'self' 'unsafe-inline'" } |
sitemapoptional | boolean | SitemapConfig | sitemap.xml with every page, each dated by the last git commit to its files |
robotsoptional | boolean | RobotsConfig | robots.txt, allowing every crawler and pointing at the sitemap |
cnameoptional | boolean | A CNAME file with the domain, for GitHub Pages |
activeLinksoptional | boolean | ActiveLink | aria-current="page" on links to the page they're on, "true" on links to its section |
tagsoptional | Record<string, TagFunction> | Your own tags: { "x-name": ({ attrs }) => "<b>html</b>" } |
transformsoptional | Transform[] | Run on every page's HTML once its placeholders are filled |
afteroptional | Hook[] | Run once the pages are written |
esbuildoptional | BuildOptions | esbuild options for every bundle, over mothwing's |