Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for lucid2 #1

Closed
lsmor opened this issue Dec 26, 2022 · 2 comments
Closed

Add support for lucid2 #1

lsmor opened this issue Dec 26, 2022 · 2 comments

Comments

@lsmor
Copy link

lsmor commented Dec 26, 2022

Current lucid-xstatic depends on lucid. It would be nice to have a lucid2-xstatic package depending on lucid2 (or maybe a cabal flag). The only difference with respect using lucid or lucid2 is that lucid2 doesn't have with function, but it can be solved easily.

-- | Adds 'script_' and 'link_' for javascript and css files.
xstaticScripts :: [XStaticFile] -> Html ()
xstaticScripts = traverse_ xrender
  where
    xrender :: XStaticFile -> Html ()
    xrender xf =
        let src = "/xstatic" <> decodeUtf8 (xfPath xf)
         in case xfType xf of
             -- "application/javascript" -> with (script_ mempty) [src_ src]               -- implementation with lucid
                "application/javascript" -> Lucid.script_ [Lucid.src_ src] ("" :: Html ())    -- implementation with lucid2
                "text/css" -> Lucid.link_ [Lucid.href_ src, Lucid.rel_ "stylesheet"]
                _ -> pure ()
@TristanCacqueray
Copy link
Owner

@lsmor thank you for the suggestion, I agree it would be nice, a new lucid2-xstatic package sounds good to me. Though I'm still blocked by haskell-servant/servant-lucid#26

@TristanCacqueray
Copy link
Owner

Lucid2 is now supported with: https://hackage.haskell.org/package/lucid2-xstatic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants