Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

serve raw files as strings if unresolvable via asset path (gist css/js)

  • Loading branch information...
commit 4c2573b7328db1551e8a8c81247b62571ee24a7b 1 parent d6261d2
@softprops authored
View
5 core/src/main/scala/Resolver.scala
@@ -29,8 +29,9 @@ class GistHttpResolver(id: String) extends Resolver {
case s => sys.error("unexpected response structure %s" format s)
}
lazy val configuration = files("conf.json")
- def resolve(p: String) = files.get(p.split('/').last)
- def exists(p: String) = files isDefinedAt p.split('/').last
+ def last(p: String) = p.split('/').last
+ def resolve(p: String) = files.get(last(p))
+ def exists(p: String) = files isDefinedAt last(p)
}
class FileSystemResolver(uri: URI) extends Resolver {
View
3  server/src/main/scala/Projector.scala
@@ -9,5 +9,8 @@ class Projector(uri: URI) extends Renderer(uri) with unfiltered.filter.Plan {
def intent = {
case Path("/") => HtmlContent ~>
ResponseString(renderDefault)
+ case Path(p) =>
+ if(exists(p)) resolve(p).map(ResponseString).getOrElse(Pass)
+ else Pass
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.