Represents the configuration of a web manifest file.
You pass your Pages.Manifest.Config record into the Pages.Manifest.generator
in your app/Api.elm module to define a file generator that will build a manifest.json file as part of your build.
import Pages.Manifest as Manifest
import Pages.Manifest.Category
manifest : Manifest.Config
manifest =
Manifest.init
{ name = static.siteName
, description = "elm-pages - " ++ tagline
, startUrl = Route.Index {} |> Route.toPath
, icons =
[ icon webp 192
, icon webp 512
, icon MimeType.Png 192
, icon MimeType.Png 512
]
}
|> Manifest.withShortName "elm-pages"Setup a minimal Manifest.Config. You can then use the with... builder functions to set additional options.
Escape hatch for specifying fields that aren't exposed through this module otherwise. The possible supported properties in a manifest file can change over time, so see MDN manifest.json docs for a full listing of the current supported properties.
A generator for Api.elm to include a manifest.json. The String argument is the canonical URL of the site.
module Api exposing (routes)
import ApiRoute
import Pages.Manifest
routes :
BackendTask FatalError (List Route)
-> (Maybe { indent : Int, newLines : Bool } -> Html Never -> String)
-> List (ApiRoute.ApiRoute ApiRoute.Response)
routes getStaticRoutes htmlToString =
[ Pages.Manifest.generator
Site.canonicalUrl
Manifest.config
]Pages.elm)Feel free to use this, but in 99% of cases you won't need it. The generated
code will run this for you to generate your manifest.json file automatically!
Represents a web app manifest file (see above for how to use it).