twitter-bootstrap - 在 grails 中集成 Bootstrap

标签 twitter-bootstrap grails

我是 grails 的新手,我正在尝试集成 bootstrap,但我在标签 r 中有错误:我正在尝试找到一些很好的教程来将 bootstrap 集成到 grails 中,但我找不到任何东西,以及任何好的东西解决方案。

我添加了 BuildConfig(我可以看到 Bootstrap 安装在我的 link_to_grails_plugins 中)

compile ":twitter-bootstrap:3.3.4"

我也这样做了:

“要包含 Bootstrap 资源,请将以下内容添加到应用程序的 css 或 js 文件中。”
Javascript grails-app/assets/javascripts/application.js:

//= require bootstrap

console.log("My javascript goes here");
Stylesheet grails-app/assets/javascripts/application.css:

/*
*= require bootstrap
*/

和这个....
布局

你的 grails-app/views/layouts/main.gsp:
<!DOCTYPE html>
<html>
<head>
    <title><g:layoutTitle default="Grails"/></title>
    <asset:stylesheet src="application.css"/>
    <g:layoutHead/>
</head>
<body>
    <g:layoutBody/>
    <asset:javascript src="application.js"/>
</body>
</html>

但是当我提出我的观点时:
<html>
    <head>
        <meta name="layout" content="main"/>
        <r:require modules="bootstrap"/>
    </head>
<body>
    <h1> Hello World </h1>
</body>
</html>
<r:require modules="bootstrap"/>标记为黄色,我可以读取未知标签 (r:require)。

最佳答案

我找到了解决方案。您必须在 BuildConfig.groovy 中添加以下内容:

运行时':twitter-bootstrap:3.3.4'

我展示了插件中必须拥有的所有代码:

plugins {
        // plugins for the build system only
        build ":tomcat:7.0.55"

        // plugins for the compile step
        compile ":scaffolding:2.1.2"
        compile ':cache:1.1.8'
        compile ":asset-pipeline:1.9.9"
        compile ":twitter-bootstrap:3.3.4"

        // plugins needed at runtime but not for compilation
        runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
        runtime ":database-migration:1.4.0"
        runtime ":jquery:1.11.1"
        runtime ':twitter-bootstrap:3.3.4'

        // Uncomment these to enable additional asset-pipeline capabilities
        //compile ":sass-asset-pipeline:1.9.0"
        //compile ":less-asset-pipeline:1.10.0"
        //compile ":coffee-asset-pipeline:1.8.0"
        //compile ":handlebars-asset-pipeline:1.3.0.3"
    }

关于twitter-bootstrap - 在 grails 中集成 Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29984867/

相关文章:

html - 表剥离不起作用?

Grails 集成测试在 Jenkins 上运行

apache - 为插件 [资源 :1. 1.6] 配置动态方法时出错:无法获取属性 'pluginPath'

grails - 从 NavigableMap 构建菜单

grails - 如何使用 Spock 和 Grails 2 模拟服务方法的接口(interface)参数?

javascript - 你能根据最小宽度将网站缩放 +200% 吗?

javascript - 每行所有列的高度相等

html - 在 bootstrap 3 的同一行上将标题文本与 div 对齐的最佳方法

html - 推特 Bootstrap : Most IE related issue happen in local server

eclipse - 如何查看和终止正在运行的 Grails 服务器