在 grails 中集成 bootstrap
Integrate bootstrap in grails
我是 grails 的新手,我正在尝试集成 bootstrap,但我在标签 r 中遇到错误:我正在尝试找到一些好的教程来集成 bootstrap在grails中,但我找不到任何东西,也找不到任何好的解决方案。
我在 BuildConfig 中添加(我可以看到 bootstrap 安装在我的 link_to_grails_plugins 中)
compile ":twitter-bootstrap:3.3.4"
我也这样做了:
"To include your bootstrap resources add the following to your application's css or js file."
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"
}
我是 grails 的新手,我正在尝试集成 bootstrap,但我在标签 r 中遇到错误:我正在尝试找到一些好的教程来集成 bootstrap在grails中,但我找不到任何东西,也找不到任何好的解决方案。
我在 BuildConfig 中添加(我可以看到 bootstrap 安装在我的 link_to_grails_plugins 中)
compile ":twitter-bootstrap:3.3.4"
我也这样做了:
"To include your bootstrap resources add the following to your application's css or js file."
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"
}