module Datapack

Defined in:

datapack.cr

Constant Summary

Data = Store.new
VERSION = "0.1.0"

Class Method Summary

Macro Summary

Class Method Detail

def self.get(path) #

Macro Detail

macro add(path, namespace = "default", mimetype = nil) #

The #add macro takes a path to a file, and optionally a namespace and a mimetype, and adds it to the datapack. If no namespace is provided, it defaults to the "default" namespace. If no mimetype is provided, the macro will make a modest attempt to apply a correct mimetype, but the macro supports only a very small set of mime-types.

The current set of extensions and mime types applied:

| Extension |            Mime Type            |
|-----------|---------------------------------|
|    bz2    | application/bzip2               |
|    cr     | text/crystal                    |
|    css    | text/css; charset=utf-8         |
|    csv    | text/csv; charset=utf-8         |
|    eot    | application/vnd.ms-fontobject   |
|    gif    | image/gif                       |
|    gz     | application/gzip                |
|    htm    | text/html; charset=utf-8        |
|    html   | text/html; charset=utf-8        |
|    ico    | image/x-icon                    |
|    jpg    | image/jpeg                      |
|    jpeg   | image/jpeg                      |
|    js     | text/javascript; charset=utf-8  |
|    json   | application/json                |
|    map    | application/json                |
|    otf    | application/font-sfnt           |
|    pdf    | application/pdf                 |
|    png    | image/png                       |
|    rb     | text/ruby                       |
|    svg    | image/svg+xml                   |
|    tar    | application/tar                 |
|    ttf    | application/font-sfnt           |
|    txt    | text/plain; charset=utf-8       |
|    xml    | text/xml; charset=utf-8         |
|    wasm   | application/wasm                |
|    webp   | image/webp                      |
|    woff   | application/font-woff           |
|    woff2  | application/font-woff2          |
|    yml    | text/yaml                       |
|    yaml   | text/yaml                       |
|    zip    | application/zip                 |

macro add_path(path, *globs, **options) #