Twitter Bootstrap Grail插件无效

时间:2013-07-05 06:47:52

标签: grails twitter-bootstrap grails-plugin grails-2.0

我是Grails的新人。我开始在3天前学习Grails。我想在我的示例Grail应用程序中使用twitter bootstrap。我正在关注此tutorial

我在grails-app / conf / BuildConfig文件中添加了runtime ':twitter-bootstrap:2.3.2'

这是我想要使用bootstrap的list.gsp文件。

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
  <head>
    <title>My Posts</title>
    <r:require modules="bootstrap"/>
  </head>
  <body>
  <g:link controller="post" action="edit">
        Create a new post
  </g:link>
  <div class="well"> 
  <h1>My Posts</h1>

  <g:each in="${posts}" var="post">
    <div>
      <h2>${post.title}</h2>
      <p>${post.teaser}</p>
      <p>Last Updated: ${post.lastUpdated}</p>
      <g:link controller="post" action="edit" id="${post.id}">
            Edit this post
      </g:link>
      <g:link controller="post" action="view" id="${post.id}">
         View this post
      </g:link>
  </div>
  </g:each>
 </div>
 </body>
 </html>

这是我的插件列表

plugins {
    runtime ":hibernate:$grailsVersion"
    runtime ":jquery:1.8.3"
    runtime ":resources:1.2"
    runtime ':twitter-bootstrap:2.3.2'

    // Uncomment these (or add new ones) to enable additional resources capabilities
    //runtime ":zipped-resources:1.0"
    //runtime ":cached-resources:1.0"
    //runtime ":yui-minify-resources:0.1.5"

    build ":tomcat:$grailsVersion"

    runtime ":database-migration:1.3.2"

    compile ':cache:1.0.1'
}

它不起作用。我是Grails的新人。我不知道为什么它不起作用。请帮忙..

1 个答案:

答案 0 :(得分:3)

添加到list.gsp

<meta name="layout" content="main"/>

并更改布局文件夹中的main.gsp,例如this example