seanhess / web-view

Typed HTML with simplified layout, and easy composable styles. Inspired by Tailwindcss and Elm UI
Other
32 stars 1 forks source link

How to use it? #2

Closed hughjfchen closed 1 month ago

hughjfchen commented 1 month ago

Hi, I'm exploring some haskell web framework and come to this through haskell discourse. I'm really interested in this library, however, I cannot find any documents(quickstart guide, or tutorial) to get started. I have went through the example but it looks like the ~client~ directory must be included to use this library in my own project? Is that true? I really hope there could be some guide to how to use this library.

hughjfchen commented 1 month ago

Sorry, I submit to the wrong repository. It should be submit to the hyperbole repository.

seanhess commented 1 month ago

I have been procrastinating releasing hyperbole because documentation is a huge project, but I should probably get on that!

In the short term, there's a bunch of examples in the example directory. The javascript is all embedded into a Haskell module. You would include it in your document function:

 toDocument :: BL.ByteString -> BL.ByteString
 toDocument cnt =
   [i|<html>
     <head>
       <title>Hyperbole Examples</title>
       <script type="text/javascript">#{scriptEmbed}</script>
       <style type type="text/css">#{cssResetEmbed}</style>
     </head>
     <body>#{cnt}</body>
</html>|]
seanhess commented 1 month ago

Oh, also, keep in mind that you can use web-view with any web framework. If you were ok with static HTML, you could use web-view to generate the HTML and deliver them with Scotty.