【发布时间】:2011-10-06 08:04:03
【问题描述】:
我正在尝试让 Blueprint (SCSS-Syntax) 与我的 Rails (3.1) 项目一起使用。 为了简单起见,在安装 compass 并创建基本的 scss 文件后,我使用一些基本的蓝图语法设置了一个纯 HTML 文件(在我的 rails 项目之外):
compass install blueprint .
它生成一个带有 screen.scss 的 sass 目录,其中包含:
@import blueprint
除其他外,stylesheets/screen.css 不包含 span-x 指令,正如我在观看 Compass: A Real Stylesheet Framework by Chris Eppstein (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(心宿二)
- 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。我的想法已经用完了......
【问题讨论】:
标签: css compass-sass sass blueprint-css