Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 在grails中集成bootstrap_Twitter Bootstrap_Grails - Fatal编程技术网

Twitter bootstrap 在grails中集成bootstrap

Twitter bootstrap 在grails中集成bootstrap,twitter-bootstrap,grails,Twitter Bootstrap,Grails,我是grails新手,我正在尝试集成bootstrap,但我在标签r中有一个错误:我正在尝试寻找一些好的教程来集成grails中的bootstrap,但我找不到任何好的解决方案 我添加了BuildConfig(我可以看到bootstrap安装在我的链接到grails插件中) 我也这样做了: “要包含引导资源,请将以下内容添加到应用程序的css或js文件中。” 而这个。。。。 布局 您的grails应用程序/views/layouts/main.gsp: <!DOCTYPE html>

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

我添加了BuildConfig(我可以看到bootstrap安装在我的链接到grails插件中)

我也这样做了:

“要包含引导资源,请将以下内容添加到应用程序的css或js文件中。”

而这个。。。。 布局

您的grails应用程序/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)。我找到了解决方案。您必须在BuildConfig.groovy中添加以下内容:

运行时“:twitter引导: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"
    }
来自资源插件。对于当前版本的grails,
资产管道
是服务于资产的默认插件。这就是IDE不知道此标记的原因。在使用资产管道时,您可以将其删除,因为
已经完成了这项工作。在您自己的回答中,您声明引导两次-我认为这不是一个好主意。您必须决定依赖范围-
编译
运行时
<html>
    <head>
        <meta name="layout" content="main"/>
        <r:require modules="bootstrap"/>
    </head>
<body>
    <h1> Hello World </h1>
</body>
</html>
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"
    }