我试图得到蓝图(scss -语法)与我的Rails(3.1)项目工作。为了保持简单,首先我设置了一个普通的HTML文件(在我的rails项目之外)与一些基本的蓝图语法,安装指南针和创建基本的scss文件:
compass install blueprint .
生成一个带有屏幕的sass目录。包含:
的SCSS@import blueprint
在其他东西中,但是stylesheets/screen.css不包含span-x指令,正如我在观看了Chris Eppstein的Compass: A Real Stylesheet Framework (http://vimeo.com/4335944)后所期望的那样,最重要的是我的HTML看起来像以前一样沉闷。
<html>
<head>
<link href="stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
<link href="stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
<!--[if lt IE 8]>
<link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body>
<div class="container">
<div class="span-24">
<center>
<h1 class="alt box">asdfhlakshf sdfgs dgf sdf sdfg fsd g</h1>
</center>
</div>
<div class="pre">
asdfhlakshf
</div>
<div class="span-4 success colborder">
WOW
</div>
</div>
</body>
</html>
我的screen.css看起来像这样(小节选):
/* line 44, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_form.scss */
form.bp input.text, form.bp input.title, form.bp input[type=email], form.bp input[type=text], form.bp input[type=password] {
width: 300px;
}
/* line 46, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_form.scss */
form.bp textarea {
width: 390px;
height: 250px;
}
/* line 39, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss */
form.bp .box {
padding: 1.5em;
margin-bottom: 1.5em;
background: #e5ecf9;
}
/* line 42, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss */
form.bp .border {
padding-right: 4px;
margin-right: 5px;
border-right: 1px solid #dddddd;
}
/* line 45, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss */
form.bp .colborder {
padding-right: 24px;
margin-right: 25px;
border-right: 1px solid #dddddd;
}
/* line 47, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss */
form.bp hr {
background: #dddddd;
color: #dddddd;
clear: both;
float: none;
width: 100%;
height: 0.1em;
margin: 0 0 1.45em;
border: none;
}
调用
compass compile
告诉我一切都保持不变。但是一旦我添加
它就会起作用@import "blueprint/grid"
例如。但是还是没有漂亮的html。
第二步,我将预编译的screen.css(从蓝图网站下载)复制到样式表文件夹中,一切都很顺利。在我的rails项目中也是如此。我可以使用预编译的css没有问题。
我想我在这里遗漏了一些基本的东西,我需要为指南针编译魔法工作,但我不知道它是什么。
提前感谢任何想法!
版本- 罗盘0.11.5 (Antares)
- ruby 1.8.7 (rails项目外) ruby 1.9.2(包含rails项目)使用rvm 1.6.21
安装haml 3.1.2和sass 3.1.4。虽然我认为这应该不相关,因为我使用html和scss,对吧?
也许我应该包含更多的screen.scss:
// This import applies a global reset to any page that imports this stylesheet.
@import "blueprint/reset";
// To configure blueprint, edit the partials/base.sass file.
@import "partials/base";
@import "blueprint/grid";
// Import all the default blueprint modules so that we can access their mixins.
@import "blueprint";
// Import the non-default scaffolding module.
@import "blueprint/scaffolding";
// To generate css equivalent to the blueprint css but with your
// configuration applied, uncomment:
// @include blueprint
// If you are doing a lot of stylesheet concatenation, it is suggested
// that you scope your blueprint styles, so that you can better control
// what pages use blueprint when stylesheets are concatenated together.
body.bp {
@include blueprint-typography(true);
@include blueprint-utilities;
@include blueprint-debug;
@include blueprint-interaction;
// Remove the scaffolding when you're ready to start doing visual design.
// Or leave it in if you're happy with how blueprint looks out-of-the-box
}
form.bp {
@include blueprint-form;
// You'll probably want to remove the scaffolding once you start styling your site.
@include blueprint-scaffolding; }
// Page layout can be done using mixins applied to your semantic classes and IDs:
body.two-col {
#container {
@include container; }
#header, #footer {
@include column($blueprint-grid-columns); }
#sidebar {
// One third of the grid columns, rounding down. With 24 cols, this is 8.
$sidebar-columns: floor($blueprint-grid-columns / 3);
@include column($sidebar-columns); }
#content {
// Two thirds of the grid columns, rounding up.
// With 24 cols, this is 16.
$content-columns: ceil(2 * $blueprint-grid-columns / 3);
// true means it's the last column in the row
@include column($content-columns, true); } }
我还尝试更改我的ruby版本,并将sass文件夹重命名为scss。
好的。这是一些基本的东西。我没有取消注释"@include blueprint"行,因为我认为@import blueprint应该足够了,当我尝试时,我得到了一个错误消息。事实证明,通过在行尾添加分号可以解决错误消息。
也许应该在发货的屏幕中添加分号。我会给作者发一封电子邮件。