How to get a TypeSafe URL to a static resource in Yesod

大憨熊 提交于 2019-12-24 04:34:05

问题


I was wondering if someone could tell me how I get a TypeSafe URL to a static resource. I've got "/static" as a subsite serving files, but I'm unclear on how to refer to specific files from there using typesafe URLs. The idea is that I could include them in things like addScript and such.

I am very new to Yesod, but I couldn't find an example like this in either the Yesod book or in the FPComplete tutorials.


回答1:


Something like this: src=@{StaticR img_myimage_png}

Yesod looks inside the static directory and the file name will contain the directory name separated by _. Replace . with _ too.



来源:https://stackoverflow.com/questions/18929610/how-to-get-a-typesafe-url-to-a-static-resource-in-yesod

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!