Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top