Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/414.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何访问fastOpt.js?_Javascript_Scala.js - Fatal编程技术网

Javascript 如何访问fastOpt.js?

Javascript 如何访问fastOpt.js?,javascript,scala.js,Javascript,Scala.js,我在跨项目的JVM项目中编译了webfastopt.js文件 [info] Fast optimizing .../main/web/jvm/target/scala-2.11/web-fastopt.js 但是,当我使用Scala标记为JVM项目呈现HTML时,似乎无法加载该文件 "<!DOCTYPE html>" + html(lang := "en")( head(header)( script(`type` := "text/javasc

我在跨项目的JVM项目中编译了
webfastopt.js
文件

[info] Fast optimizing .../main/web/jvm/target/scala-2.11/web-fastopt.js
但是,当我使用Scala标记为JVM项目呈现HTML时,似乎无法加载该文件

    "<!DOCTYPE html>" + html(lang := "en")(
      head(header)(
        script(`type` := "text/javascript", src:= "./target/scala-2.11/web-fastopt.js"),
      scalatags.Text.tags.body(body, footer)(optJs.map(js ⇒ onload := js.cmd))
    )
“”+html(lang:=“en”)(
头部(头部)(
脚本(`type`:=“text/javascript”,src:=”/target/scala-2.11/web fastopt.js”),
scalatags.Text.tags.body(body,footer)(optJs.map(js⇒ onload:=js.cmd)
)

有人知道我可以参考的任何跨项目工作示例吗?我在网上找到的示例实际上无法运行本地服务器。

我发现上面的代码有三个问题:

  • 编译的
    fastopt.js
    应该生成到JVM项目的资源目录中
  • 源代码应该是
    src:=“/webfastopt.js”
  • 最后,因为我使用Akka HTTP进行路由,所以我应该添加
    getFromResourceDirectory(“”
    作为最后一个路由
  • 这样,将从根url加载
    fastopt.js