---
title: "Hugo theme works locally, not on S3"
date: 2016-11-05
description: "Fixing broken CSS on an S3-hosted Hugo site -- the culprit was S3 serving stylesheets with the wrong MIME type, solved with s3cmd's --no-mime-magic flag."
categories:
  - hugo
---


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 'http://daimyo.org/css/style.css'
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: [//github.com/s3tools/s3cmd/issues/198](https://github.com/s3tools/s3cmd/issues/198).

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.
