我正在构建一个Rails应用程序,我决定使用bootstrap和sass。
我遵循github页面上的指南:
https://github.com/twbs/bootstrap-sass所以,现在我安装了gem ('bootstrap-sass','sass-rails'),我的application.css (现在的application.sass)如下所示:
1 @import "bootstrap-sprockets";
2 @import "bootstrap";我的application.js文件如下所示:
1 // This is a manifest file that'll be compiled into application.js, which will include all the files
2 // listed below.
3 //
4 // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6 //
7 // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 // compiled file.
9 //
10 // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11 // about supported directives.
12 //
13 //= require jquery
14 //= require jquery_ujs
15 //= require turbolinks
16 //= require bootstrap-sprockets
17 //= require_tree .然后这个指南差不多就结束了。问题是我的应用程序中没有bootstrap (通过查看源代码,我无法在页面的任何位置看到它),并且我不知道如何使用sass。我接下来该怎么办?我错过了什么吗?
发布于 2015-01-22 19:56:47
听起来这一切都应该准备好了,但你必须开始编写一些可以应用的代码。也许可以用这个来测试它。在application.html.erb文件的body下放置以下内容:
<div id="container">
<div class="main">
<h1>Main Content</h1>
</div>然后在css文件中尝试如下所示
#container {
.main {
width:600px;
h1 {
color: $red;
}
}确保在安装包之后重新启动了服务器。引导程序变量列表可以在http://getbootstrap.com/customize/#less-variables中找到
发布于 2015-01-22 22:07:46
我发现了错误:我将所有的import标签写在html
<title>标记而不是
<head> 标签。
https://stackoverflow.com/questions/28087758
复制相似问题