metalsmith-serve icon indicating copy to clipboard operation
metalsmith-serve copied to clipboard

handle mime types

Open leviwheatcroft opened this issue 7 years ago • 2 comments

metalsmith-serve should be able to read mime-types from file meta and set the mimetype on the response header.

I was playing around with it here you can set the mimetype, but node-static just overwrites it. There's a closed issue about this on node-static. There's a number of other (open) issues on node-static re mimetypes. I don't think it's going to be resolved any time soon.

Take a look at this post on the slack channel, it kind of explains the context of what I'm trying to do.

So any ideas on how this might be fixed upstream ? I know it would be impractical to change dependencies for such a small feature, but there are other static servers that could easily resolve this.

leviwheatcroft avatar Jan 08 '17 00:01 leviwheatcroft

Hey, I don't really use slack and don't have access to the metalsmith channel, so I can't look at what you're trying to do there.

The spirit of metalsmith-serve (as the readme says) was to ease development of sites and avoid having to build all the time and/or running another tool to test out what you're working for. It never never intended or designed to be a server running your site, as there are tools much better suited for that.

mayo avatar Jan 09 '17 03:01 mayo

Hey, Totally agree that metalsmith-serve shouldn't aim to be a production server.

Some static hosts (including S3) allow you to set a mime-type for files without extensions, so a static site can get naked urls like http://foo.com/about by renaming about.html to about and setting the mimetype on the response header.

So in order to use metalsmith-serve during development on a site like this, you need similar functionality.

There's a lot of considerations, what I posted on slack sortof puts things in context. Here's a public copy.

leviwheatcroft avatar Jan 09 '17 04:01 leviwheatcroft