From 7bc7ea2cc7ea56fb027de3a7643c9eda34dfb6e1 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Sat, 15 May 2021 18:17:02 -0700 Subject: [PATCH] Simplify template. --- generator/template/src/Document.elm | 8 ++-- generator/template/src/Shared.elm | 12 +---- generator/template/src/Site.elm | 73 ++++------------------------- 3 files changed, 16 insertions(+), 77 deletions(-) diff --git a/generator/template/src/Document.elm b/generator/template/src/Document.elm index 45172837..aa26f026 100644 --- a/generator/template/src/Document.elm +++ b/generator/template/src/Document.elm @@ -1,23 +1,23 @@ module Document exposing (Document, map, placeholder) -import Html.Styled exposing (text) +import Html exposing (Html) type alias Document msg = { title : String - , body : List (Html.Styled.Html msg) + , body : List (Html msg) } map : (msg1 -> msg2) -> Document msg1 -> Document msg2 map fn doc = { title = doc.title - , body = List.map (Html.Styled.map fn) doc.body + , body = List.map (Html.map fn) doc.body } placeholder : String -> Document msg placeholder moduleName = { title = "Placeholder - " ++ moduleName - , body = [ text moduleName ] + , body = [ Html.text moduleName ] } diff --git a/generator/template/src/Shared.elm b/generator/template/src/Shared.elm index 75ce6865..b6e0f7c0 100644 --- a/generator/template/src/Shared.elm +++ b/generator/template/src/Shared.elm @@ -1,14 +1,11 @@ module Shared exposing (Data, Model, Msg(..), SharedMsg(..), template) import Browser.Navigation -import Css.Global import DataSource import Document exposing (Document) import Html exposing (Html) -import Html.Styled import Pages.PagePath exposing (PagePath) import SharedTemplate exposing (SharedTemplate) -import Tailwind.Utilities template : SharedTemplate Msg Model Data SharedMsg msg @@ -93,12 +90,7 @@ view : -> (Msg -> msg) -> Document msg -> { body : Html msg, title : String } -view stars page model toMsg pageView = - { body = - Html.Styled.div [] - (Css.Global.global Tailwind.Utilities.globalStyles - :: pageView.body - ) - |> Html.Styled.toUnstyled +view sharedData page model toMsg pageView = + { body = Html.div [] pageView.body , title = pageView.title } diff --git a/generator/template/src/Site.elm b/generator/template/src/Site.elm index 333c8780..bb136bdf 100644 --- a/generator/template/src/Site.elm +++ b/generator/template/src/Site.elm @@ -1,100 +1,47 @@ module Site exposing (config) -import Cloudinary -import Color import DataSource import Head -import MimeType -import Pages.ImagePath as ImagePath exposing (ImagePath) import Pages.Manifest as Manifest -import Pages.Manifest.Category import Pages.PagePath as PagePath import Route exposing (Route) import SiteConfig exposing (SiteConfig) import Sitemap +type alias Data = + () + + config : SiteConfig Data config = \routes -> { data = data - , canonicalUrl = canonicalUrl + , canonicalUrl = "https://elm-pages.com" , manifest = manifest , head = head } -type alias Data = - { siteName : String - } - - data : DataSource.DataSource Data data = - DataSource.map Data - --(StaticFile.request "site-name.txt" StaticFile.body) - (DataSource.succeed "site-name") + DataSource.succeed () head : Data -> List Head.Tag head static = - [ Head.icon [ ( 32, 32 ) ] MimeType.Png (cloudinaryIcon MimeType.Png 32) - , Head.icon [ ( 16, 16 ) ] MimeType.Png (cloudinaryIcon MimeType.Png 16) - , Head.appleTouchIcon (Just 180) (cloudinaryIcon MimeType.Png 180) - , Head.appleTouchIcon (Just 192) (cloudinaryIcon MimeType.Png 192) - , Head.sitemapLink "/sitemap.xml" + [ Head.sitemapLink "/sitemap.xml" ] -canonicalUrl : String -canonicalUrl = - "https://elm-pages.com" - - manifest : Data -> Manifest.Config manifest static = Manifest.init - { name = static.siteName - , description = "elm-pages - " ++ tagline + { name = "Site Name" + , description = "Description" , startUrl = PagePath.build [] - , icons = - [ icon webp 192 - , icon webp 512 - , icon MimeType.Png 192 - , icon MimeType.Png 512 - ] + , icons = [] } - |> Manifest.withShortName "elm-pages" - - -tagline : String -tagline = - "A statically typed site generator" - - -webp : MimeType.MimeImage -webp = - MimeType.OtherImage "webp" - - -icon : - MimeType.MimeImage - -> Int - -> Manifest.Icon -icon format width = - { src = cloudinaryIcon format width - , sizes = [ ( width, width ) ] - , mimeType = format |> Just - , purposes = [ Manifest.IconPurposeAny, Manifest.IconPurposeMaskable ] - } - - -cloudinaryIcon : - MimeType.MimeImage - -> Int - -> ImagePath -cloudinaryIcon mimeType width = - Cloudinary.urlSquare "v1603234028/elm-pages/elm-pages-icon" (Just mimeType) width siteMap :