I just wrote an answer to this on StackOverflow: <a href="http://stackoverflow.com/questions/27200701/hosting-a-static-site-with-yesod/27204171#27204171">http://stackoverflow.com/questions/27200701/hosting-a-static-site-with-yesod/27204171#27204171</a><br><br><div class="gmail_quote">On Sat, Nov 29, 2014, 5:43 PM Christopher Reichert <<a href="mailto:creichert07@gmail.com">creichert07@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On Sat, Nov 29 2014, Yifan Yu <<a href="mailto:yvifan@gmail.com" target="_blank">yvifan@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> I'm experimenting with Yesod and I've created a simple scaffolding site<br>
> with yesod. I've downloaded a bootstrap template site and wish to simply<br>
> host this site with yesod. The template site has an index.html and a bunch<br>
> of css and js files. This seemly simple task has baffled me. By my<br>
> understanding, the site should be placed under the 'static' directory, I<br>
> tried to use sendFile to send the index.html file in getHomeR, but only the<br>
> content of the that file is displayed, without the css and js. Should I do<br>
> this with a Subsite?<br>
><br>
<br>
You might want to try the question on the Yesod mailing lists if you<br>
don't find your answer here.<br>
<br>
A simple solution would be to just port the index.html to hamlet and put<br>
that directly in the ./templates/homepage.hamlet file. The<br>
homepage.hamlet file is complimented by a homepage.julius and<br>
homepage.lucius file which takes a flavor of javascript and css,<br>
respectively. In Yesod, the combination of these files is known as a<br>
widget.<br>
<br>
You can move your javascript and css into those widget files directly or<br>
you can put them in your static dir (but your html is served from<br>
homepage.hamlet by default in the scaffold).<br>
<br>
The static directory is already a subsite for static resources (see the<br>
config/routes file).<br>
<br>
Also see the section "widgetFile" in this Yesod Book chapter:<br>
<a href="http://www.yesodweb.com/book/scaffolding-and-the-site-template" target="_blank">http://www.yesodweb.com/book/<u></u>scaffolding-and-the-site-<u></u>template</a><br>
<br>
If you want to serve the static files as a separate subsite you might<br>
find the following links helpful:<br>
<br>
<a href="https://github.com/yesodweb/yesod/wiki/Static-file-subsite-Hello-World" target="_blank">https://github.com/yesodweb/<u></u>yesod/wiki/Static-file-<u></u>subsite-Hello-World</a><br>
<a href="https://groups.google.com/forum/#!msg/yesodweb/Cz8hvgiu0d0/l90NGvhAyLEJThis" target="_blank">https://groups.google.com/<u></u>forum/#!msg/yesodweb/<u></u>Cz8hvgiu0d0/l90NGvhAyLEJThis</a><br>
<br>
Hope that helps,<br>
<br>
--<br>
Christopher Reichert<br>
irc: creichert<br>
gpg: C81D 18C8 862A 3618 1376  FFA5 6BFC A992 9955 929B<br>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
</blockquote></div>