hugo theme works locally not on s3

November 5, 2016

I attempted to setup a new Hugo site with the S3 websites feature. When I ran the Hugo server locally, my theme displayed correctly. However, when I uploaded it to S3, the CSS wasn’t displaying, even though the files were there.

The dev console in Chrome showed that it was fetching the CSS files, but it was failing to render them. When I opened the error console in Safari, it finally told me the issue: "Did not parse stylesheet at '' because non CSS MIME types are not allowed in strict mode."

Since I was using s3cmd to upload my site into the bucket, I did some Googling which led me to this bug report: //

The long and short is that CSS has issues getting mime type autodetected, so even when you run s3cmd with the --guess-mime-type flag, it still wouldn’t set the correct mimetype. Once I set the –no-mime-magic flag, everything was happy again. Be sure to check mimetype in S3 afterward to ensure it is being set properly.

comments powered by Disqus