jameshfisher
jameshfisher

Reputation: 36549

How do I use StaticRoute values in Hamlet?

The TH call

$(staticFiles "static")

dumps a load of values of type StaticRoute.

Hamlet typesafe URLs (i.e. @{...}) take values of type Route Foo, where Foo is my foundation.

There must be a way of using the StaticRoute values as URLs in Hamlet. That is, one of the following must exist:

However, I can't find either. Help?

Upvotes: 2

Views: 146

Answers (1)

Michael Snoyman
Michael Snoyman

Reputation: 31345

You want the StaticR constructor, which will convert a route for the static subsite to a route for your specific application. Technically, you can name that constructor whatever you want, but the scaffolding site and just about every example and real application I've ever seen stick with that convention.

Upvotes: 4

Related Questions