如何通过 play-framework 压缩 JS 和 CSS?
“Google Closure Compiler”已被删除,因此不再是一个选项。
我正在使用 play Activator 2.3.7
注意:此问题不重复,因为 Google Closure Compiler 已从 Activator 2.3.7 中删除。
最佳答案
Play 2.4 同理。
将空的 main.js 添加到公用文件夹
插件.sbt:
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
构建.sbt:
pipelineStages := Seq(rjs)
生成生产可执行文件:
$activator stage
运行结果:
./target/universal/stage/bin/<yourproject>
注意:当运行activator stage你应该看到它输出缩小/丑化的过程:
...
[info] Tracing dependencies for: main
[info] Uglify2 file: /path/to/your/project/public/something.js
...
关于javascript - 通过 Play Framework 缩小客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29272840/