Hello, i just found that we can use minify in config https://gohugo.io/news/0.68.0-relnotes/ but i didn’t find any tutorials for that or any article that explain it more can someone please help
I don’t know if you can “use minify in config”, but I know you can “configure the minify via config file”.
See asset minification to actually “use it”.
i tried this on my head partial and called the css files but it failed to build i think the problem is from my theme it’s really old
so just adding this lines to my config.toml file will make it work ? or do i have to make some other modifications
[minify]
disableCSS = false
disableHTML = false
disableJS = false
disableJSON = false
disableSVG = false
disableXML = false
minifyOutput = false
[minify.tdewolff]
[minify.tdewolff.css]
decimals = -1
keepCSS2 = true
[minify.tdewolff.html]
keepConditionalComments = true
keepDefaultAttrVals = true
keepDocumentTags = true
keepEndTags = true
keepQuotes = false
keepWhitespace = false
[minify.tdewolff.js]
[minify.tdewolff.json]
[minify.tdewolff.svg]
decimals = -1
[minify.tdewolff.xml]
keepWhitespace = false
As I said, those lines will only configure the minification behavior. You must “invoke” the minification, by using asset minification function and/or hugo --minify
.
For anyone who steps upon here, the configuration didn’t work because minifyOutput = false
. Changing this line to = true
works.
Running hugo with the --minify
command line flag takes precedence over minifyOutput = false
in the site configuration.