如何在Play Framework 2.3中使用Twitter Bootstrap 3 [英] How to use Twitter Bootstrap 3 with play framework 2.3

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

问题描述

我一直在尝试将bootstrap的js和css文件添加到play framework应用程序中的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 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

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

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