Represents the configuration of a web manifest file.
You pass your Pages.Manifest.Config
record into the Pages.application
function
(from your generated Pages.elm
file).
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"
{ backgroundColor : Maybe Color
, categories : List Category
, displayMode : DisplayMode
, orientation : Orientation
, description : String
, iarcRatingId : Maybe String
, name : String
, themeColor : Maybe Color
, startUrl : Path
, shortName : Maybe String
, icons : List Icon
, lang : LanguageTag
}
Represents a web app manifest file (see above for how to use it).
{ src : Pages.Url.Url
, sizes : List ( Basics.Int
, Basics.Int )
, mimeType : Maybe MimeType.MimeImage
, purposes : List IconPurpose
}
https://developer.mozilla.org/en-US/docs/Web/Manifest/icons
init : { description : String, name : String, startUrl : Path, icons : List Icon } -> Config
Setup a minimal Manifest.Config. You can then use the with...
builder functions to set additional options.
withBackgroundColor : Color -> Config -> Config
Set https://developer.mozilla.org/en-US/docs/Web/Manifest/background_color.
withCategories : List Category -> Config -> Config
Set https://developer.mozilla.org/en-US/docs/Web/Manifest/categories.
withDisplayMode : DisplayMode -> Config -> Config
Set https://developer.mozilla.org/en-US/docs/Web/Manifest/display.
withIarcRatingId : String -> Config -> Config
Set https://developer.mozilla.org/en-US/docs/Web/Manifest/iarc_rating_id.
withLang : LanguageTag -> Config -> Config
Set https://developer.mozilla.org/en-US/docs/Web/Manifest/lang.
withOrientation : Orientation -> Config -> Config
Set https://developer.mozilla.org/en-US/docs/Web/Manifest/orientation.
withShortName : String -> Config -> Config
Set https://developer.mozilla.org/en-US/docs/Web/Manifest/short_name.
withThemeColor : Color -> Config -> Config
Set https://developer.mozilla.org/en-US/docs/Web/Manifest/theme_color.
See https://developer.mozilla.org/en-US/docs/Web/Manifest/display
https://developer.mozilla.org/en-US/docs/Web/Manifest/orientation
https://w3c.github.io/manifest/#dfn-icon-purposes
Pages.elm
)toJson : String -> Config -> Json.Encode.Value
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!