如何在Yesod中获取TypeSafe URL到静态资源 [英] How to get a TypeSafe URL to a static resource in Yesod
问题描述
我想知道是否有人可以告诉我如何获得TypeSafe URL到静态资源。我已将/ static作为子网站提供文件,但我不清楚如何使用类型安全网址从那里引用特定文件。我的想法是,我可以将它们包含在addScript等类似的东西中。
我对Yesod很新颖,但我找不到像这样的例子。 Yesod书或FPComplete教程。
类似这样: src = @ {StaticR img_myimage_png}
Yesod查看静态目录,文件名将包含由 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. Something like this: Yesod looks inside the static directory and the file name will contain the directory name separated by 这篇关于如何在Yesod中获取TypeSafe URL到静态资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! _ $ c分隔的目录名$ C>。用
_
替换。
。 src=@{StaticR img_myimage_png}
_
. Replace .
with _
too.