Build and minify
The build table, and HTML, CSS and JavaScript minification.
Build#
[build] is accepted for compatibility. cacheBusters, useResourceCacheWhen and noJSConfigInAssets are checked and have no effect: fugo always runs a pipeline’s steps, and writes no jsconfig.json.
buildStats (and the older writeStats) is no longer supported, and a warning says so: fugo writes no file of the classes and tags pages use. purge_css reads each page itself, and Tailwind CSS finds the classes in your layouts.
Minify#
fugo build --minify, or minifyOutput, minifies every HTML, CSS, JavaScript, JSON, SVG and XML file fugo writes. disableHTML, disableCSS, disableJS, disableJSON, disableSVG and disableXML turn off one type:
[minify]
minifyOutput = true
disableXML = trueminify:
disableXML: true
minifyOutput: true{
"minify": {
"disableXML": true,
"minifyOutput": true
}
}fugo’s minifiers are lightningcss (CSS), oxc (JavaScript) and minify-html (HTML). A table per type sets their options:
[minify]
minifyOutput = true
[minify.html]
keepComments = true
[minify.js]
keepVarNames = trueminify:
html:
keepComments: true
js:
keepVarNames: true
minifyOutput: true{
"minify": {
"html": {
"keepComments": true
},
"js": {
"keepVarNames": true
},
"minifyOutput": true
}
}html.keepComments- Keep every HTML comment (
false). html.keepSpecialComments- Keep server-side-include comments,
<!--#…-->(true). html.keepEndTags,html.keepDocumentTagsfalseleaves out optional closing tags, and<html>and<head>opening tags without attributes (true).html.keepDefaultAttrValsfalseleaves outtype="text"on<input>(true).html.templateDelims["{{", "}}"]keeps{{ }},{% %}and{# #}as written,["<%", "%>"]keeps<% %>.css.keepCSS2- Write colours in CSS files as
rgb()andrgba()with commas, not as hex with alpha (true). js.keepVarNames- Do not rename local variables (
false). svg.keepComments- Keep comments in SVG files (
false). xml.keepWhitespace- Keep the whitespace of XML text as written (
false).
The Go implementation’s other minifier options (keepQuotes, precision, …) are accepted and have no effect. Its name for these tables, [minify.tdewolff], is still read, with a deprecation notice.
In a page, each inline <script> is minified by its type: JavaScript (classic scripts and modules) by oxc, JSON (application/ld+json, application/json, import maps) by the JSON minifier. Other types, such as client-side templates (text/x-template), and scripts that do not parse are kept as written.