twitter-bootstrap - 游戏框架中的 Bootstrap 字形图标

标签 twitter-bootstrap playframework playframework-2.0

我想使用 Bootstraps glyphicons游戏框架

所以当我使用 <i class="icon-search" /> , Bootstrap 正在“assets/img/...”中寻找图标。此行为与 anatomy of a play application 冲突。因为图像在“assets/images/...”中。

所以我试图通过为“assets/img”的 GET 请求定义一个额外的路由来重新映射它:

# Map static resources from the /public folder to the /assets URL path
GET     /assets/img/*file           controllers.Assets.at(path="/public/images", file)
GET     /assets/*file               controllers.Assets.at(path="/public", file)

但是这样做,我得到一个编译错误“没有足够的方法参数:(路径:字符串,文件:字符串)play.api.mvc.Call。未指定的值参数文件。”在我调用的所有其他公共(public) Assets 上。

我究竟做错了什么?

最佳答案

实际上描述我的问题帮助我在这里搜索它;) ...stackoverflow 已经有了答案。希望我的问题至少与我自己回答的这个问题有更多的相关性。

根据How to use Twitter Bootstrap 2 with play framework 2.x我必须为每个单独的 glyphicons 文件定义静态路由,然后对其他 Assets 的请求不会被“错误路由”。

我只是添加了

# Map Bootstrap images
GET     /assets/img/glyphicons-halflings.png            controllers.Assets.at(path="/public", file="/images/glyphicons-halflings.png")
GET       /assets/img/glyphicons-halflings-white.png      controllers.Assets.at(path="/public", file="/images/glyphicons-halflings-white.png")

# Map static resources from the /public folder to the /assets URL path
GET     /assets/*file               controllers.Assets.at(path="/public", file)

到我的路线,所以我不需要以特殊方式修改任何框架。

无论如何感谢您的建议

关于twitter-bootstrap - 游戏框架中的 Bootstrap 字形图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15344727/

相关文章:

javascript - Chart.js 在隐藏的 Bootstrap 选项卡中呈现

html - 在我的网页左右两侧放置装饰图片

playframework - 使用 Java 1.8 运行框架 1.2.7.x

unit-testing - 框架如何发挥单元测试 Controller 方法

java - Play Framework 2 在 Intellij IDEA 中运行 JUnit 测试

jquery - Bootstrap 按钮不起作用(单击时未打开)

jquery - 使用搜索按钮制作响应式导航栏

scala - 在 Play Framework 2.5 的 scala twirl 模板中使用 isProd 和 isDev

java - PowerMock 在测试类中抛出类未找到异常

mongodb - Play-ReactiveMongo - 可以在 Controller 之外使用插件吗?