3

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.

  • Did you see [this example](http://hpaste.org/47216)? I've never used Happstack, but it definitely looks like they link in a CSS file on line 15. – Jeff Burka Jul 13 '12 at 20:13
  • @JeffreyBurka I saw it, but it doesn't show how they get happstack to serve up the css file. –  Jul 13 '12 at 20:25

1 Answers1

4

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"
jdeseno
  • 7,753
  • 1
  • 36
  • 34