With Tailwind v4, and default hugo
command, the CSS file is not minified in CF Pages even though it is a .min.css
file. Do I need to add anything to the build command?
When I follow these steps, then run hugo
(not hugo server
), my public directory looks like this:
public/
├── css/
│ └── main.eb81ff5e4f0a07045edf9554b7efa00641e43d041b4e514f3795fade5e4b58ba.css
├── posts/
│ ├── post-1/
│ │ └── index.html
│ └── index.html
├── favicon.ico
└── index.html
And the CSS file is definitely minified.
I had a Go Panic issue with Hugo v0.145.0 and this code was recommended panic: deferred execution with id "__hdeferred/...=" not found · Issue #13492 · gohugoio/hugo · GitHub. I checked my public folder after running hugo
and indeed the code for the .css
is unminified.
Are you using the optimize
option instead of the minify
option? I’d need to see the code.
I just copied that code as it is in the issue comment to the partial and base file.
Change optimize
to minify
and don’t pass the result through the minify
function.
You shouldn’t have to do this… I’m looking into it.
Thank you. That worked!
The problem is upstream:
https://github.com/tdewolff/minify/issues/651
Setting aside #13492, our documentation is correct:
But I will update the issue comment.
Noted! What does “optimize” mean in this context?
From the Tailwind CLI help:
-m, --minify ·········· Optimize and minify the output
--optimize ········ Optimize the output without minifying
Our documentation mirrors theirs:
Neither describes what “optimize” means, and I haven’t found an official explanation anywhere. Let me know if you find one.
https://github.com/tailwindlabs/tailwindcss/discussions/17507
Interesting! I initially thought optimize is a word encompassing both minify and fingerprint. Let’s here from the TW folks.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.