4
我是grails中的新手,我正在嘗試集成bootstrap,但是我在標籤r中有錯誤:我試圖找到一些很好的教程來將引導集成到grails中,但我可以'找到任何東西,以及任何好的解決方案。在grails中集成引導
我BuildConfig添加(我可以看到,引導安裝在我的link_to_grails_plugins)
compile ":twitter-bootstrap:3.3.4"
我做到了,這也太:
「要包括你的引導資源以下內容添加到您的應用程序的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 /視圖/佈局/ 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)。
' '來自資源插件。通過當前版本的grails,「asset-pipeline」是服務資產的默認插件。這就是爲什麼你的IDE不知道這個標籤。在使用資產管道時,可以將其刪除,因爲''已經實現了。在你自己的答案中,你宣佈bootstrap兩次 - 我不認爲這是一個好主意。您必須決定依賴範圍 - 「編譯」或「運行時」。 –