Javascript Scala:如何在Finatra中包含一个JS脚本到Mustache模板?

Javascript Scala:如何在Finatra中包含一个JS脚本到Mustache模板?,javascript,scala,mustache,finatra,Javascript,Scala,Mustache,Finatra,我试图在我的小胡子模板文件中包含一个JS脚本 <html> <head> <script id="{{app.js}}" type="text/mustache"></script> </head> <body> <div> Users: <ul> {{#users}} <li>{{name}}</li>

我试图在我的小胡子模板文件中包含一个JS脚本

<html>
<head>
    <script id="{{app.js}}" type="text/mustache"></script>
</head>
<body>
<div>
    Users:
    <ul>
        {{#users}}
            <li>{{name}}</li>
        {{/users}}
    </ul>
</div>
</body>
</html>
这是我的问题。如何将JS脚本添加到我的胡须模板

UPD

我也试着用

<script src='{{path}}/public/app.js' type='text/javascript'></script>
我把所有资产都放在

src/main/resources/public/*

在我看来,这应该是

您需要有一个额外的路由来为您的js文件提供服务,它以您使用的前缀/约定命名

get("/assets/js/:file") { request: Request =>
    response.ok.file(request.getParam(file))
}

请参见

这是一个很好的观点。查看我的更新。但目前还不清楚如何方便地获取静态文件。
response.ok.file(String)
函数无法正常工作。它产生
404notfound
。函数的定义是
file(file:String)
fileOrIndex(filePath:String,indexPath:String)
。它们使用param
-doc.root
作为位置标识符。删除
newfile()
并将字符串放入函数中,因为它已经指向
src/main/resources
campaign.csv
campaign.xls
位于
src/main/resources/*
src/main/resources/public/*
get("/assets/js/:file") { request: Request =>
    response.ok.file(request.getParam(file))
}