~toastal/dhall-webmanifest

Web App Manifest for the Dhall configuration language
Flake update + fix Cachix
AsciiDoc, MPL, SourceHut
a4d81b5b — toastal 3 years ago
x

clone

read-only
https://git.sr.ht/~toastal/dhall-webmanifest
read/write
git@git.sr.ht:~toastal/dhall-webmanifest

You can also use your local clone with git send-email.

Web App Manifest in the Dhall configuration language. The Web App Manifest enables progressive web apps (PWAs). For information about the Manifest’s compatibility, see browser compatibility via MDN.

This project is available on GitLab and mirrored on SourceHut (though which is the mirror is subject to change).

Usage

Create a file like ./webmanifest.dhall

-- Pick a tag/commit hash! Freeze it too!
let WebAppManifest =
      https://gitlab.com/toastal/dhall-webmanifest/raw/trunk/src/WebAppManifest.dhall sha:…
    ? https://git.sr.ht/~toastal/dhall-webmanifest/blob/trunk/src/WebAppManifest.dhall sha:…

in    WebAppManifest::{
      , name = "toast.al"
      , lang = Some "en-US"
      , dir = Some WebAppManifest.TextDirection.Type.ltr
      , display = Some WebAppManifest.DisplayMode.Type.browser
      , orientation = Some WebAppManifest.OrientationLock.Type.natural
      , theme_color = Some "#f2008a"
      , background_color = Some "#f8f8f6"
      , categories = Some [ "blog", "programming" ]
      , icons =
        [ { src = "icon.avif"
          , sizes = Some "64x64"
          , type = Some "image/avif"
          , purpose = Some
              ( WebAppManifest.ManifestImageResource.Purpose.concatShow
                  [ WebAppManifest.ManifestImageResource.Purpose.Type.any
                  , WebAppManifest.ManifestImageResource.Purpose.Type.maskable
                  ]
              )
          }
        , { src = "favicon.ico"
          , sizes = Some "16x16 32x32"
          , type = None Text
          }
        , WebAppManifest.ImageResource::{ src = "icon.svg", purpose = Some "any" }
        ]
      }
    : WebAppManifest.Type

(sorry, no syntax highlighting on GitLab or SourceHut; rouge issue #1054)

Then to generate a minified .webmanifest (Content-Type: application/manifest+json) file for browser consumption

$ dhall-to-json --compact --omit-empty --file ./webmanifest.dhall --output ./manifest.webmanifest

Test drive & verify

If you have curl and json-to-dhall installed on your $PATH, you can check the Dhall Discourse’s Web App Manifest file.

$ curl --compressed "https://discourse.dhall-lang.org/manifest.json" \
  | json-to-dhall "(https://gitlab.com/toastal/dhall-webmanifest/raw/trunk/Webmanifest/WebAppManifest.dhall).Type"

Setup

Git

$ git config --local include.path ../.gitconfig
$ git config --local core.hooksPath .githooks

Nix + Flakes

For dev shell

$ nix develop

For automatic shell via direnv

$ direnv allow

License

This project is licensed under Mozilla Public License Version 2.0 - see the ./LICENSE file for details.

Funding

If you want to make a small contribution to the maintanence of this & other projects