com-lihaoyi / scalatags

ScalaTags is a small XML/HTML construction library for Scala.
https://com-lihaoyi.github.io/scalatags/
MIT License
758 stars 117 forks source link

Problem with Layout example from readme (bis) #108

Closed antoinekagit closed 8 years ago

antoinekagit commented 8 years ago

I got the same problem of the issue with the same name (closed). But only when I import : import scalatags.Text.tags2._ No problem when I import something like import scalatags.Text.tags2{section, title}

Note that the documentation still use Seq[Modifier] which does not work, instead of Seq[Frag].

stewSquared commented 8 years ago

Pasting the documentation into the repl after import scalatags.Text.all._ works just fine, and I've personally used Seq[Modifier] plenty of times.

Could you post a minimal failing example? Does your compile error really only happen when you change that one import?

lihaoyi commented 8 years ago

closing out of inactivity

antoinekagit commented 8 years ago

maybe i am doing something wrong ?

import scalatags.Text.all._

object Test {
  def page(scripts: Seq[Modifier], content: Seq[Modifier]) =
    html(
      head(scripts),
      body(
        h1("This is my title"),
        div(cls := "content")(content)
      )
    )

  val htm = page(
    Seq(
      script("some script")
    ),
    Seq(
      p("This is the first ", b("image"), " displayed on the ", a("site")),
      img(src:="www.myImage.com/image.jpg"),
      p("blah blah blah i am text")
    )
  )
}

libraryDependencies [info] List(org.scala-lang:scala-library:2.10.5, com.lihaoyi:scalatags:0.5.4)

compile [info] Compiling 2 Scala sources to [...]/target/scala-2.10/classes... [error] [...]/test.scala:6: No implicit view available from scalatags.Text.all.Modifier => scalatags.Text.Frag. [error] head(scripts), [error] ^ [error] one error found error Compilation failed [error] Total time: 1 s, completed Jan 23, 2016 2:34:14 PM