如何在播放框架 2.3 中使用 Twitter Bootstrap 3 [英] How to use Twitter Bootstrap 3 with play framework 2.3

查看:29
本文介绍了如何在播放框架 2.3 中使用 Twitter Bootstrap 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将引导程序的 js 和 css 文件添加到 play 框架应用程序中的 public/javascripts 和 public/stylesheets 应用程序.我不知道为什么,但我得到一个空白的输出.这是使用 play v2.3 进行引导程序 v3 的正确方法吗?如果不是,那么正确的程序是什么?

I have been trying adding bootstrap's js and css files to public/javascripts and public/stylesheets application in play framework application. I donno why but I get a blank output. Is it the correct way to proceed for bootstrap v3 with play v2.3? If not what's the correct procedure to do it?

推荐答案

DO NOT 手动分割下载的库,有什么用?它包含相对路径.

DO NOT divide downloaded library manually, what for? It contains relative paths.

只需将其解压缩到 public/bootstrap 文件夹中,然后将 JS/CSS 作为公共公共资源包含在内:

Just unzip it i.e. into public/bootstrap folder and include JS/CSS from there as common public asset:

<link rel="stylesheet" 
  href="@routes.Assets.at("assets/bootstrap/css/bootstrap.css")">
<script type='text/javascript' 
  src='@routes.Assets.at("assets/bootstrap/js/bootstrap.js")'></script>

当然我假设你有 Play 创建的默认路由:

of course I assume that you have default route created by Play:

GET  /assets/*file   controllers.Assets.at(path="/public", file)

提示:您提到的这些文件夹只是示例,它不会使您倾向于任何事情...您可以移动/重命名/删除它们,无论如何

TIP: these folders you mentioned are just sample, it doesn't oblique you to anything... you can move/rename/delete them, whatever

这篇关于如何在播放框架 2.3 中使用 Twitter Bootstrap 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆