我想要将Twitter的Bootstrap引入我的Grails 3应用程序中。最好的方法是什么?我既不想将源代码放在版本控制下,也不想引用远程CDN。
在我的build.gradle
中添加"org.grails:grails-bootstrap:3.0.1"
作为编译依赖项会下载相关的JAR文件,但是如何将其连接到我的应用程序中,最终能够从我的视图/GSP中引用Bootstrap类呢?
我想要将Twitter的Bootstrap引入我的Grails 3应用程序中。最好的方法是什么?我既不想将源代码放在版本控制下,也不想引用远程CDN。
在我的build.gradle
中添加"org.grails:grails-bootstrap:3.0.1"
作为编译依赖项会下载相关的JAR文件,但是如何将其连接到我的应用程序中,最终能够从我的视图/GSP中引用Bootstrap类呢?
Webjars 对我很有帮助,在application.js
和application.css
中使用了 webjars 链接,但链接并不总是定义良好的(请参见 typeahead 示例)
application.js:
//= require jquery-2.1.3.js
//= require_tree .
//= require_self
//= require /webjars/bootstrap/3.3.5/js/bootstrap.min
//= require /webjars/bootstrap-tagsinput/0.5/bootstrap-tagsinput
//= require /webjars/typeaheadjs/0.11.1/typeahead.bundle.js
application.css:
/*
*= require main
*= require mobile
*= require_self
*= require /webjars/bootstrap/3.3.5/css/bootstrap-theme
*= require /webjars/bootstrap/3.3.5/css/bootstrap
*= require /webjars/bootstrap-tagsinput/0.5/bootstrap-tagsinput
*/
compile 'org.webjars:bootstrap:3.3.5'
。 - boraas编译 'org.webjars:typeaheadjs:0.11.1'
编译 'org.webjars:bootstrap:3.3.5'
编译 'org.webjars:bootstrap-tagsinput:0.5'
编译 'org.webjars.bower:bootstrap-table:1.8.1'
...
运行时 "org.grails.plugins:asset-pipeline"
...
// 注意:建议更新到更强大的驱动程序(Chrome、Firefox等)
测试运行时 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.44.0'控制台 "org.grails:grails-console"
} - boraasmedia="screen, projection"
这样的属性?例如:<link rel="stylesheet" href="/assets/webjars/bootstrap/3.3.5/css/bootstrap-theme.css?compile=false" media="screen, projection">
- Jonathan Airey//= require bootstrap
样式表 grails-app/assets/javascripts/application.css:
/*
*= require bootstrap
*/
我正在使用这个插件 kensiprell/bootstrap-framework,并把以下路径添加到.gitignore
中,以便在第一次运行时下载资源。
/grails-app/assets/javascripts/bootstrap
/grails-app/assets/javascripts/bootstrap-all.js
/grails-app/assets/stylesheets/font-awesome
/grails-app/assets/stylesheets/bootstrap
/grails-app/assets/stylesheets/font-awesome-less.less
/grails-app/assets/stylesheets/bootstrap-less.less
/grails-app/assets/stylesheets/bootstrap-all.css
/grails-app/assets/stylesheets/font-awesome-all.css