Skip to content

Instantly share code, notes, and snippets.

@julien-truffaut
Last active July 10, 2016 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julien-truffaut/dd51f88445063ae60b029089e1eed7a4 to your computer and use it in GitHub Desktop.
Save julien-truffaut/dd51f88445063ae60b029089e1eed7a4 to your computer and use it in GitHub Desktop.
Scalacss issue
package foobar.style
import scalacss.Defaults._
object ExampleStyle extends StyleSheet.Inline {
import dsl._
val ul = style(
backgroundColor.blue
)
}
package foobar.page
import foobar.style.ExampleStyle
import scalacss.Defaults._
import scalacss.ScalatagsCss._
import scalatags.Text._
import scalatags.Text.all._
import scalatags.Text.tags2.title
object Index {
val page =
html(
ExampleStyle.render[TypedTag[String]],
title("FooBar"),
head(),
body(
h1("FooBar"),
TopNav.page
)
)
}
package foobar
import foobar.page.Index
import org.http4s.HttpService
import org.http4s.MediaType.`text/html`
import org.http4s.dsl._
import org.http4s.headers.`Content-Type`
import org.http4s.server.ServerApp
import org.http4s.server.blaze._
object Server extends ServerApp {
val service = HttpService {
case GET -> Root => Ok(Index.page.render).withContentType(Some(`Content-Type`(`text/html`)))
}
def server(args: List[String]) = BlazeBuilder.bindHttp(8080)
.mountService(service, "/")
.start
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment