winton / stasis

Static sites made powerful
http://stasis.me
MIT License
677 stars 56 forks source link

Additional mime type via CLI in development mode. (SVG not displayed, mimetype in webrick missing) #70

Closed georgiee closed 11 years ago

georgiee commented 11 years ago

I use svg files in my css files. They are not display with the current webrick configuration due to the lack of a proper mime type configuration. There is currently no way to add additional mime types to the webrick configuration. I monkey patched additional mime type support in a local copy of the stasis gem. These are the code changes summarized in a pull request, perhaps it`s useful for somebody else or the project itself.

#New: CLI call example single stasis -d 3100 -m svg,image/svg+xml
#New: CLI call example multiple stasis -d 3100 -m svg,image/svg+xml,js, application/javascript

#changed in dev_mode.rb around line 48. mime_types are read via CLI.
#See Commit for the other changes regarding slop/CLI reading
additional_mime_types = @options[:mime_types]
additional_mime_types.each do |extension, mimetype|
  mime_types.store extension, mimetype
  puts "add mime type #{mimetype} with extension .#{extension}"
end
winton commented 11 years ago

Thank you!