Skip to content

Example doesn't work in Scala 3 with latest versions and sbt #231

@yatesco

Description

@yatesco

Hi there - I copied your example from cask/scalatags but used the latest versions and Scala 3 and I'm getting a spurious error:

Found:    scalatags.Text.all.html.Self
Required: scalatags.text.Frag

The following import might make progress towards fixing the problem:

  import sourcecode.Text.generate


      html(

build.sbt:

val scala3Version = "3.1.0"

lazy val root = project
  .in(file("."))
  .settings(
    name := "Pride and Joy",
    version := "0.1.0-SNAPSHOT",

    scalaVersion := scala3Version,

    libraryDependencies += "com.lihaoyi" % "cask_3" % "0.8.0",
    libraryDependencies += "com.lihaoyi" % "requests_3" % "0.7.0",
    libraryDependencies += "com.lihaoyi" % "scalatags_3" % "0.11.0",
    libraryDependencies += "com.lihaoyi" % "utest_3" % "0.7.10" % "test",
    libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test",
  )

src/main/scala/Main:

//package app
import scalatags.Text.all._

object Main extends cask.MainRoutes{
  @cask.get("/")
  def hello() = {
    doctype("html")(
      html(
        body(
          h1("Hello World"),
          p("I am cow")
        )
      )
    )
  }

  initialize()
}

Is this something obvious, or should I stick with the older versions used in the demo?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions