Compass Blueprint mixins没有编译?

时间:2011-07-15 16:56:48

标签: css compass-sass sass blueprint-css

我正在尝试使用我的Rails(3.1)项目使用Blueprint(SCSS-Syntax)。 为了简单起见,我在安装指南针并使用以下命令创建基本scss文件后,使用一些基本的蓝图语法设置一个纯HTML文件(在我的rails项目之外):

compass install blueprint .

它生成一个带有screen.scss的sass目录,其中包含:

@import blueprint

除了其他内容之外,样式表/ screen.css不包含span-x指令,正如我在看过Compass: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(从蓝图网站下载)复制到stylesheets文件夹,一切都像魅力一样。在我的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。我这里的想法已经不多了......

1 个答案:

答案 0 :(得分:1)

好的。这是基本的东西。我没有取消注释“@include blueprint”行,因为我认为@import蓝图应该足够了,当我尝试时,我会收到错误消息。 原来通过在行尾添加分号来解决错误消息。

也许应该在发货的screen.scss中添加smicolon。我会发送一封电子邮件给作者。