
On Sat, Nov 29 2014, Yifan Yu
Hi all,
I'm experimenting with Yesod and I've created a simple scaffolding site with yesod. I've downloaded a bootstrap template site and wish to simply host this site with yesod. The template site has an index.html and a bunch of css and js files. This seemly simple task has baffled me. By my understanding, the site should be placed under the 'static' directory, I tried to use sendFile to send the index.html file in getHomeR, but only the content of the that file is displayed, without the css and js. Should I do this with a Subsite?
You might want to try the question on the Yesod mailing lists if you don't find your answer here. A simple solution would be to just port the index.html to hamlet and put that directly in the ./templates/homepage.hamlet file. The homepage.hamlet file is complimented by a homepage.julius and homepage.lucius file which takes a flavor of javascript and css, respectively. In Yesod, the combination of these files is known as a widget. You can move your javascript and css into those widget files directly or you can put them in your static dir (but your html is served from homepage.hamlet by default in the scaffold). The static directory is already a subsite for static resources (see the config/routes file). Also see the section "widgetFile" in this Yesod Book chapter: http://www.yesodweb.com/book/scaffolding-and-the-site-template If you want to serve the static files as a separate subsite you might find the following links helpful: https://github.com/yesodweb/yesod/wiki/Static-file-subsite-Hello-World https://groups.google.com/forum/#!msg/yesodweb/Cz8hvgiu0d0/l90NGvhAyLEJThis Hope that helps, -- Christopher Reichert irc: creichert gpg: C81D 18C8 862A 3618 1376 FFA5 6BFC A992 9955 929B