0

我有一个网站结构,我使用函数来最大化代码重用。有时我需要某个页面将更多脚本或样式表添加到 html 页面的头部。下面的代码做我想要的,除了我被迫使用一个div或其他一些标签来包含其余的 scalatags。我真的不想div在我的文档的头部添加一个随机标签。我可以为此目的使用一些通用/空标签吗?(tag("")顺便说一句编译错误。)

import scalatags.Text.all._

class Temp {

  def document = html(
    head(
      script("some javascript"),
      extraScripts
    ),
    body(
      h1("A website")
    )
  )

  def extraScripts = div( // <-- This div is the part I want to change
    script("More scripts"),
    script("and what not")
  )

}
4

0 回答 0