Joey Eremondi
Joey Eremondi

Reputation: 8433

How to get a TypeSafe URL to a static resource in 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.

Upvotes: 2

Views: 402

Answers (1)

Ecognium
Ecognium

Reputation: 2076

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.

Upvotes: 3

Related Questions