微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

twitter-bootstrap – 如何使用Twitter Bootstrap 2与播放框架2.x

我知道当前玩!分发有一个帮助Bootstrap 1.4。如果我想使用当前版本的Bootstrap,该怎么办?

解决方法

我使用2.0.1 twitter bootstrap与Play 2.0。您可以在这里下载特定版本: https://github.com/twitter/bootstrap/tags。一旦你下载twitter启动,你有两个选择:

>你可以选择只使用bootstrap.min.css(和bootstrap-responsive.css)和bootstrap.min.js,所有这些文件都可以放在public文件夹中。
>或者你可以使用较少的文件为CSS。如果你想使用较少的文件,你做以下包(在你的应用程序文件夹的根):

assets.stylesheets.bootstrap

在你构建scala,你定义这些.less文件应该编译:

// Only compile the bootstrap bootstrap.less file and any other *.less file in the stylesheets directory 
def customLessEntryPoints(base: File): pathfinder = ( 
    (base / "app" / "assets" / "stylesheets" / "bootstrap" * "bootstrap.less") +++
    (base / "app" / "assets" / "stylesheets" / "bootstrap" * "responsive.less") +++ 
    (base / "app" / "assets" / "stylesheets" * "*.less")
)

val main = PlayProject(appName,appVersion,appDependencies,mainLang = JAVA).settings(
  // Add your own project settings here
    lessEntryPoints <<= baseDirectory(customLessEntryPoints)
)

然后你可以将它包含在你的模板:

<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/bootstrap/bootstrap.min.css")" />
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/bootstrap/responsive.min.css")" />

编辑:2012-09-17:
如果您计划从源代码构建Play,请按照本教程的Play Wiki页面https://github.com/playframework/Play20/wiki/Tips

编辑:2012-09-21:
当使用引导程序时,您总是必须做出选择,无论是更改文件夹图像还是向引导程序使用的两个静态图像添加路由:

编辑:2013-03-11:
当xref指向,我犯了一个错误:img必须是图像:

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

原文地址:https://www.jb51.cc/bootstrap/234488.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐