在Play中,如何将js文件从ScalaJS客户端复制到服务器?

eje211

我正在尝试编写一部分ScalaJS和一部分Play框架的应用程序。我正在使用ScalaJS捆绑器它很好地捆绑了我的JavaScript,我可以看到生成的文件应该放在哪里。

在此处输入图片说明

但我注意到只有client-jsdeps.jsclient-fastopt.js可用于该应用程序。这样做的原因是,它们是唯一复制到路径的文件server/target/web/public/main我到处都是我想过的地方,生成sbt文件,配置文件,到处都找不到,为什么找不到这些文件被复制的原因。我想-bundle改为复制文件。那地方在哪里?

It is worth noting that the two files that are packaged with the app do not appear in the user-editable path, server/public/js, they are copied directly to the WAR file and therefore visible in the target directory.

Julien Richard-Foy

From the documentation:

For sbt-web integration use the sbt-web-scalajs-bundler plugin instead of sbt-scalajs-bundler:

addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.13.1")

Then, enable the WebScalaJSBundlerPlugin on the project that uses sbt-web:

lazy val server = project
  .settings(
    scalaJSProjects := Seq(client),
    pipelineStages in Assets := Seq(scalaJSPipeline)
  )
  .enablePlugins(WebScalaJSBundlerPlugin)

lazy val client = project.enablePlugins(ScalaJSBundlerPlugin, ScalaJSWeb)

You also need to setup the ScalaJSBundlerPlugin on the Scala.js project, as described in the preceding section, and the sbt-web-scalajs plugins as described in their documentation.

The WebScalaJSBundlerPlugin plugin automatically configures the scalaJSPipeline task to use the bundles rather than the output of the Scala.js compilation.

您可以在此处看到完整的示例


您是否遵循该指南?

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何通过脚本将javascript文件从服务器复制到客户端pc

使用 Libssh 将文件从服务器复制到客户端:分配文件复制目标路径的问题

将文件夹从服务器复制到在特定时间戳之间创建的客户端?

将客户端公用密钥复制到Windows OpenSSH SFTP / SSH服务器授权密钥文件的命令

使用golang通过其余端点将文件从客户端复制到服务器

我应该将服务器的ca.crt复制到客户端吗?

如何使用scp将ssh密钥从客户端服务器复制到linux桌面

如何将jwt从swift客户端传递到node.js服务器

如何在Google Earth Engine中将值从服务器复制到客户端?

如何将节点 js 服务器中的 html 格式数据附加到客户端的 html 文件中?

如何将数据从服务器传输到客户端js文件?

如何将erlang cassandra客户端文件包含到ejabberd服务器中?

如何将文件复制到远程linux服务器中的共享帐户

我如何将Java对象从服务器端传递到客户端

解决将文件从服务器复制到客户端(反之亦然)时解决“套接字已关闭”的异常

如何将值从 golang 发送到 vue js(服务器到客户端)?

如何将响应作为 URL 从服务器检索到客户端

如何将CSRF令牌从服务器传递到客户端?

在Node.js / Express.js中,如何将JSON对象从服务器传输到客户端?

SaltStack:如何将文件从小兵复制到SaltStack文件服务器

如何将JPG文件从服务器发送到客户端

如何将文件从多个服务器复制到本地系统?

如何将文件从远程服务器复制到本地计算机?

如何将文件从远程服务器复制到本地计算机?

如何将文件从远程UNIX服务器复制到本地Windows?

如何将文件内容从远程服务器复制到本地机器位置?

将多个文件复制到多个客户端

Shell 脚本:如何将文件列表从服务器 1 复制到服务器 2

如何将字典项从客户端(Ajax)传递到服务器端(MVC API)