Question

I'm wondering what the best way to go about including css in Happstack webpages would be. I tried google, with no luck, so I thought I would ask here.

Was it helpful?

Solution

The easiest method for me was to serve them from a static folder. Eg adding a handler like:

dir "static" $ serveDirectory DisableBrowsing [] "www"

Replace "www" with the directory that you want happstack to use. For more information on serveDirectory, see the Haddock documentation.

Then I have a www/css folder where all of my css lives. I use Blaze templates so I link to them all directly:

H.link ! A.rel "stylesheet" ! A.type_ "text/css" ! A.href "/static/css/foo.css"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top